Re: [R] Dataframe help

From: Erik Iverson <iverson_at_biostat.wisc.edu>
Date: Wed, 05 Nov 2008 10:46:38 -0600

Hello -

Rajasekaramya wrote:
> Hi there,
>
> I have a dataframe length.unique.info
>> length.unique.info
> abc 12 345
> def 16 550
> lmn 6 600

Is this really the output when you print your data.frame? You may have column names for columns 1, 2, and 3? Is the first column a column of row.names, or not? What does dim(length.unique.info) give?

Assuming you have names for columns "1", "2" and "3", named, e.g., X1, X2 and X3

subset(length.unique.info, X2 <= 5 & X3 >= 500, select = c(X1))

I don't know what you're trying to do by indexing with 'i'.

And to answer your question about '&', see ?Logic

> I want those names that fall under the condition (length.unique.info[,2][i]
> <=5 && length.unique.info[,3][i] >=500)
>
> abcder<-length.unique.info[which(length.unique.info[,2][i] <=5 &&
> length.unique.info[,3][i] >= 500),1]
>
> will "&&" look for both the condition.It isnt returning names is there
> anything i am missing.Kindly suggest me the way to do it.
>
> Regards
> Ramya
>
>
>



R-help_at_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. Received on Wed 05 Nov 2008 - 16:49:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Nov 2008 - 17:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive