the data.frame argument isnt working

Continuing the discussion from Wilcoxon test wont go right:

fvfm0n3 <- data.frame(ZND0, all_of(ZND3)) %>% gather(key = "day", value = "FvFm", ZND0, ZND3)
Note: Using an external vector in selections is ambiguous.
i Use all_of(ZND3) instead of ZND3 to silence this message.
i See https://tidyselect.r-lib.org/reference/faq-external-vector.html.
This message is displayed once per session.
Error: Must subset columns with a valid subscript vector.
x Can't convert from to due to loss of precision.
so i started making my own tables with data frames and this is the second error after adding all_of
this are the vectors
ZND0 <- c(0.16345747, 0.14249414, 0.13196069)
ZND3 <- c(0.104881450, 0.105833764, 0.114355231)
before this was the message
fvfm0n3 <- data.frame(zer0 = ZND0, three = ZND3) %>% gather(key = "day", value = "FvFm", ZND0, ZND3)
Note: Using an external vector in selections is ambiguous.
i Use all_of(ZND0) instead of ZND0 to silence this message.
i See https://tidyselect.r-lib.org/reference/faq-external-vector.html.
This message is displayed once per session.
Error: Must subset columns with a valid subscript vector.
x Can't convert from to due to loss of precision
i don't know what to do this is like stopping my whole document from being converted in Rmarkdown

first of all, there is no problem with the following code, i.e. it does not benefit from the use of all_of

ZND0 <- c(0.16345747, 0.14249414, 0.13196069)
ZND3 <- c(0.104881450, 0.105833764, 0.114355231)

data.frame(zer0 = ZND0,
           three = ZND3) 

I think your issue here relates to your use of gather. What is your intent ?
You want a longer structure, this would work

ZND0 <- c(0.16345747, 0.14249414, 0.13196069)
ZND3 <- c(0.104881450, 0.105833764, 0.114355231)
data.frame(zer0 = ZND0,
           three = ZND3)  %>% 
 gather(key = "day",value = "FvFm")

#or 
data.frame(zer0 = ZND0,
           three = ZND3)  %>% 
 gather(key = "day",value = "FvFm",zer0,three)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.