Hi R-expert, I try to eliminate 29 Feb but I got an error message below: feb_data1 <- Pooraka_data[Pooraka_data$Month=="2",] feb_28days <- feb_data1 [feb_data1$Day=="28",] feb_29days <- feb_data1 [feb_data1$Day=="29",] ## delete 29 Feb feb_no_29 <- feb_data1 [-(feb_29days),] feb_no_29 <- feb_data1 [-(feb_29days),] Error in xj[i] : invalid subscript type 'list' Thank you so much for your attention. ____________________________________________________________________________________ [[elided Yahoo spam]]
What you are getting back in 'feb_no_29' is a data frame which can not be used for indexing. Do 'str(feb_no_29)' and see what you set. What you probably want to do is to use 'which' to find out which rows match the criteria and then delete them: feb_29 <- which((Pooraka_data$Month == "2") & (Pooraka_data$Day == "29")) data_without_2_29 <- Pooraka_data[-feb_29,] On Sun, May 11, 2008 at 8:54 PM, Roslina Zakaria <zroslina@yahoo.com> wrote:> Hi R-expert, > I try to eliminate 29 Feb but I got an error message below: > feb_data1 <- Pooraka_data[Pooraka_data$Month=="2",] > feb_28days <- feb_data1 [feb_data1$Day=="28",] > feb_29days <- feb_data1 [feb_data1$Day=="29",] > ## delete 29 Feb > feb_no_29 <- feb_data1 [-(feb_29days),] > feb_no_29 <- feb_data1 [-(feb_29days),] > Error in xj[i] : invalid subscript type 'list' > Thank you so much for your attention. > > > > ____________________________________________________________________________________ > > [[elided Yahoo spam]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[alternative HTML version deleted]]
Why dont you use the rattle GUI for data selection ? Regards, Ajay On Mon, May 12, 2008 at 6:24 AM, Roslina Zakaria <zroslina@yahoo.com> wrote:> Hi R-expert, > I try to eliminate 29 Feb but I got an error message below: > feb_data1 <- Pooraka_data[Pooraka_data$Month=="2",] > feb_28days <- feb_data1 [feb_data1$Day=="28",] > feb_29days <- feb_data1 [feb_data1$Day=="29",] > ## delete 29 Feb > feb_no_29 <- feb_data1 [-(feb_29days),] > feb_no_29 <- feb_data1 [-(feb_29days),] > Error in xj[i] : invalid subscript type 'list' > Thank you so much for your attention. > > > > ____________________________________________________________________________________ > > [[elided Yahoo spam]] > > ______________________________________________ > R-help@r-project.org mailing list > 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. >[[alternative HTML version deleted]]