[R] dataframe help
David Winsemius
dwinsemius at comcast.net
Tue Nov 25 15:14:50 CET 2008
Not sure that solution properly focuses the unique function on the
first column, and even when I tried to do so, my code using did not
produce what I expected. The unique function does not return a logical
vector.
Try:
ships[!duplicated(ships$type), ]
And Rajasekaramya, please include code that creates the test data next
time.
--
David Winsemius
On Nov 25, 2008, at 8:01 AM, stephen sefick wrote:
> you will get more help if you provide code that can be copied and
> pasted into an R session.
> ?dput
>
> #untested to say the least
> foo[unique(foo),]
>
> On Mon, Nov 24, 2008 at 5:36 PM, Rajasekaramya <ramya.victory at gmail.com
> > wrote:
>>
>> hi there
>>
>> I have a dataframe
>>
>> abc 123 345
>> abc 345 456
>> lmn 567 345
>> hkl 568 535
>> lmn 096 456
>> lmn 768 094
>>
>> i want the uniques of column 1 and there corresponsing column 2 and 3
>> output
>> abc 123 345
>> lmn 567 345
>> hkl 568 535
>>
>> cbind(DF1[,1],DF1[which(unique(DF1[,1]),c(2,3)])
>> but didnt work
>>
>> kindly let me know how to go abt it
>>
>> ramya
>> --
>> View this message in context: http://www.nabble.com/dataframe-help-tp20671461p20671461.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> --
> Stephen Sefick
>
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods. We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
> -K. Mullis
>
> ______________________________________________
> 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.
More information about the R-help
mailing list