Dear Dr. David,

Many thanks for your answer.

Now, if I want to see if there are common "name"in those "places" , how can
I do it? So, by common I mean, it might be compared with 2, 3, 4 .... all
of them. All possible combinations

Many thanks

regards

Nico


On Mon, Jun 3, 2013 at 5:20 PM, David Carlson <dcarlson@tamu.edu> wrote:

> It may be easier if you convert the list you provided to a
> data.frame:
>
> > dta.df <- data.frame(place=dta$place, name=dta$name,
> value=dta$value)
> > dta.df
>
> Note that the last line is blank so you probably want to remove that
> and remove the blank factor levels:
>
> > dta.df <- dta.df[-nrow(dta.df),]
> > dta.df$place <- factor(dta.df$place)
> > dta.df$name <- factor(dta.df$name)
> > dta.df
>
> Now you can make a list containing separate data.frames by place
>
> > dta.df.sp <- split(dta.df, dta.df$place)
> > dta.df.sp
>
> -------------------------------------
> David L Carlson
> Associate Professor of Anthropology
> Texas A&M University
> College Station, TX 77840-4352
>
>
> -----Original Message-----
> From: r-help-bounces@r-project.org
> [mailto:r-help-bounces@r-project.org] On Behalf Of Nico Met
> Sent: Monday, June 3, 2013 8:42 AM
> To: R help
> Subject: [R] split and common variables
>
> Dear all,
>
> I would like to split the data based on the "place" and then would
> like to
> see how many "names" were common in place with corresponding "value"
> .
>
> Please find a demo file.
>
> Thanks for your expert comment
>
> best
>
> Nico
>
> > dput(dta)
> structure(list(place = structure(c(3L, 2L, 5L, 6L, 4L, 3L, 2L,
> 5L, 6L, 4L, 2L, 5L, 6L, 4L, 2L, 5L, 6L, 4L, 2L, 3L, 2L, 5L, 6L,
> 4L, 3L, 2L, 5L, 6L, 4L, 5L, 6L, 4L, 5L, 6L, 1L), .Label = c("",
> "GCKT", "IKLI", "KLOI", "PLRT", "POIV"), class = "factor"), name =
> structure
> (c(2L,
> 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 2L, 3L, 4L, 5L, 6L,
> 7L, 8L, 9L, 10L, 11L, 12L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
> 11L, 12L, 12L, 1L), .Label = c("", "P_CK23", "P_CK24", "P_CK25",
> "P_CK26", "P_CK27", "P_CK28", "P_CK29", "P_CK30", "P_CK31",
> "P_CK32",
> "P_CK33"), class = "factor"), value = c(5.9464, 6.0786, -4.5155,
> 15.0241, -38.1847, -0.0861, 1.2757, -23.9914, 9.5951, -11.128,
> 6.2826, 23.5218, 20.862, 3.1626, 6.242, -20.5348, -14.0126, -13.796,
> 15.3869, -15.7409, -8.1963, -14.4522, 3.2117, -1.2738, 14.3556,
> -12.5337, 20.4308, -3.3227, -34.802, -11.1103, -9.7146, -35.9044,
> -9.4303, -28.1949, NA)), .Names = c("place", "name", "value"), class
> = "data
> .frame", row.names = c(NA,
> 35L))
> >
>
>         [[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]]

