On Mar 21, 2013, at 7:39, Pierrick Bruneau <pbrun...@gmail.com> wrote:
> Hi Borja, > > You may issue: > > attach(data) No -- bad idea -- dangerous -- confusing statefulness, etc. (See explanations in the archives as to why) > > which results in adding your column names to the search path of R for name > resolving. > > Pierrick Bruneau > CRP Gabriel Lippmann > > > On Wed, Mar 20, 2013 at 11:17 PM, Borja . <borjalato...@outlook.com> wrote: > >> Good day. >> I create a data frame like this: >>> data <- data.frame(a=1:10,b=11:20,c=21:30) >> I can subset this data.frame by saying: >>> data[data$a>7,] >> and I get this result >> a b c 8 8 18 28 >> 9 9 19 29 10 10 20 30 >> I understand I should get the same result by saying >>> data[a>7,0] >> but I don't. Instead I get: >> Error in `[.data.frame`(data, a > 7, 0) : object 'a' not Try instead with(dat, dat[a > 0, ]) for a cleaner option. MW >> found >> Thank you very much in advance >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> 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]] > > ______________________________________________ > 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. ______________________________________________ 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.