My question is exactly the same to this link Plot multiple box-plots using columns of dataframe in R
The only difference is that I have lots of NA among the numeric variables, I tried to run the suggested code by jbaums (you can see the suggested programming code in this link) but I got NULL as a results. Do you have any idea regarding fixing this issue. Thanks.
For example:
categ<-c(1,2,2,1,2,2,1,2,1,2)
var1 <- c(10:15,NA,NA,NA,34)
var2 <- c(100:115,NA,23,NA,34)
var3 <- c(20:25,NA,NA,NA,34)
var4 <- c(1000:1015,23,NA,NA,500)
var5 <- c(1:5,NA,NA,NA,NA,NA)
data.frame(categ,var1,var2,var3,var4,var5)
Can you post the exact code you're running and a sample of your data? Just a head(data)
or even just str(data)
should be enough.
Looking at the docs for boxplot ( ?boxplot
in the R console) suggests that the default behaviour is to ignore NA values, but you can try to set na.action = NULL
in your call to boxplot. If it's not working then the problem is in the rest of your code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.