So I have a data frame: df and I plot it but there are too many Na's and it is not nice.
So I try to remove Na's with 1):
df <- na.omit(df)
But my data are getting messed up. 2):
df <- df[!is.na(df$column_name),]
This work for a specific column name but in the plot I have multiple column names with Na's and when I try to use the same command but for other column name it changes my data complitely. So can anyone help me? Is there a way to !is.na
(Multiple column names) Or Ignore NA's In a ggplot?
I am using this:
df<-Ass1MatrixNoNa %>% gather(test, value, 3:5)
ggplot(df,aes(x=test,fill=value)) +
geom_bar(position=position_dodge(preserve="single"))
And I get a plot but with NA's
Then I try to remove the NA's:
Ass1MatrixNoNa <- Ass1Matrix[!is.na(Ass1Matrix$Ass_1_hearingA),]
Removes the Ass_1_hearingA Na's But I want also hearingB but ovverides the first one and the NA's are removed only in the second one:
Ass1MatrixNoNa <- Ass1Matrix[!is.na(Ass1Matrix$Ass_1_hearingB]