As this is my first post here, I hope I do everything correctly. Otherwise, I am happy to correct myself.
I am working with a dataframe consisting of about 50 columns and 300 entries which is called "fbdaten". In this data frame, I am interested in all entries that have no NA in either "Vertraeglichkeit", "Offenheit" or "Statistik". I tried the following code with na.omit to create a new dataframe which contains all entries that don't have NA in any one of these columns:
fbdatenNoNA <- na.omit(fbdaten[,c("Statistik", "Offenheit", "Neurotizismus")]) fbdatenNoNA
However, I do get an Output that only contains the columns "Statistik", "Offenheit" and "Neurotizismus". But I still need to see all 50 columns, not only these.
I tried this alternative code i found on the R documentation:
fbdatenNoNA <- na.omit(fbdaten, cols = c("Statistik", "Offenheit", "Neurotizismus")) fbdatenNoNA
However, this output gives me exactly the same as when I just use
fbdatenNoNAatAll <- na.omit(fbdaten)
which works totally fine but is not what I need since I only need to exclude the entries that have NA in either of these above mentioned columns and not entries with NA's in any column...
Usually, I would get on fine with the R documentation, but this somehow just does not want to work and I am thankful for any input at all!
Thank you very much already!