Hi all, I am reading a field data that contains several variables. The sample of the data with the first two variables is shown below. I wanted to know the minimum and maximum recording date However, I have some problem. Name Rdate V1 to V20 Alex1 01/03/2015 Alex2 01/03/2014 Alex3 31/12/2012 Alex4 15/01/2011 Alex150 22/01/2010 Alex151 15/02/2011 DF1=DF1[!is.na(DF1$Rdate),] range(DF1$Rdate, na.rm=TRUE) Warning message: In is.na(DF1$Rdate) : is.na() applied to non-(list or vector) of type 'NULL' Error in DF1$Rdate : $ operator is invalid for atomic vectors Execution halted I am expecting the Rdate field should contain recording dates. I am suspecting there might be a non date value in that columns. How do I remove that row if it is not a date format? Thank you.
Show us str(DF1) . It is not a data frame. -- Bert On Fri, Apr 14, 2017 at 9:02 PM, Ashta <sewashm at gmail.com> wrote:> Hi all, > I am reading a field data that contains several variables. The sample > of the data with the first two variables is shown below. I wanted to > know the minimum and maximum recording date However, I have some > problem. > > > Name Rdate V1 to V20 > Alex1 01/03/2015 > Alex2 01/03/2014 > Alex3 31/12/2012 > Alex4 15/01/2011 > Alex150 22/01/2010 > Alex151 15/02/2011 > > > > DF1=DF1[!is.na(DF1$Rdate),] > range(DF1$Rdate, na.rm=TRUE) > > Warning message: > In is.na(DF1$Rdate) : > is.na() applied to non-(list or vector) of type 'NULL' > Error in DF1$Rdate : $ operator is invalid for atomic vectors > Execution halted > > I am expecting the Rdate field should contain recording dates. I am > suspecting there might be a non date value in that columns. How do I > remove that row if it is not a date format? > > > Thank you. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
DF1 is a data frame. I am suspecting there might be non date value in that column. My question is how to remove a non date values from that field. example if Alex152 has 12253,. This value is not a date format. On Fri, Apr 14, 2017 at 11:24 PM, Bert Gunter <bgunter.4567 at gmail.com> wrote:> Show us str(DF1) . It is not a data frame. > > -- Bert > > > > > On Fri, Apr 14, 2017 at 9:02 PM, Ashta <sewashm at gmail.com> wrote: >> Hi all, >> I am reading a field data that contains several variables. The sample >> of the data with the first two variables is shown below. I wanted to >> know the minimum and maximum recording date However, I have some >> problem. >> >> >> Name Rdate V1 to V20 >> Alex1 01/03/2015 >> Alex2 01/03/2014 >> Alex3 31/12/2012 >> Alex4 15/01/2011 >> Alex150 22/01/2010 >> Alex151 15/02/2011 >> >> >> >> DF1=DF1[!is.na(DF1$Rdate),] >> range(DF1$Rdate, na.rm=TRUE) >> >> Warning message: >> In is.na(DF1$Rdate) : >> is.na() applied to non-(list or vector) of type 'NULL' >> Error in DF1$Rdate : $ operator is invalid for atomic vectors >> Execution halted >> >> I am expecting the Rdate field should contain recording dates. I am >> suspecting there might be a non date value in that columns. How do I >> remove that row if it is not a date format? >> >> >> Thank you. >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code.