I'm tring to assign dataframe value to a dataframe in ifelse query,but failed.I have no idea about that
df <- data.frame(x=c('a','g','s'),y=c(2,3,4))
df_1 <- ifelse(2>1,df,NULL)
execute and get the following result:
> df_1
[[1]]
[1] a g s
Error in if (n <= 1L || lenl[n] <= width) n else max(1L, which.max(lenl > :
missing value where TRUE/FALSE needed
the actual results should be
> df
x y
1 a 2
2 g 3
3 s 4