Re: [R] merging two lists but get indexes

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun 14 Jan 2007 - 14:55:50 GMT

Try:

a <- read.csv("book1.csv", as.is = TRUE)

to read the columns in as "character" class rather than the default of "factor" .
See ?read.csv

On 1/14/07, Teng Sun <ewisdom@gmail.com> wrote:
> Suppose I have two columns of entries, how can I get the union of the
> two columns? Please note: I input my columns through excel. These
> entries have text format in excel. Also, out of curiosity, how can I
> find out the data type of a data frame ?
>
>
> > a <- read.csv("book1.csv")
> > a
> n1 n2
> 1 apple soda
> 2 orange apple
> 3 soda green
> 4 red yellow
> 5 white blue
> 6 white
>
> > union(a$n1,a$n2)
> [1] 2 3 5 4 6 1
>
> I want the actual names instead of the indexes.
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 Mon Jan 15 02:04:53 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 14 Jan 2007 - 18:30:28 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.