We have a data frame from a CSV file. The DF data frame contains columns containing the observed values ββand a column ( VaR2 ) that contains the date on which the measurement was performed. If the date was not recorded, the CSV file contains the value NA , for missing data.
Var1 Var2 10 2010/01/01 20 NA 30 2010/03/01
We would like to use the subset command to define a new data frame new_DF so that it contains only rows with the value NA' from the column ( VaR2 ). In the above example, the new DF will only contain line 2.
Team
new_DF<-subset(DF,DF$Var2=="NA")
does not work, the resulting data frame has no entries in the row.
If the value of NA exchanged with NULL in the source CSV file, the same command gives the desired result: new_DF<-subset(DF,DF$Var2=="NULL") .
How can I make this method work if for a character string the value NA specified in the source CSV file?
r csv dataframe na subset
John Nov 02 2018-11-12T00: 00Z
source share