Re: [R] getting a new factor

From: Manuel Morales <Manuel.A.Morales_at_williams.edu>
Date: Sun 31 Dec 2006 - 03:04:35 GMT

On Sun, 2006-12-31 at 00:25 +0100, Ricardo Rodríguez wrote:
> Hi all,
>
> Given a data frame as...
>
> > head(veg)
> genus species trophia type geo zone importance
> 1 Sphagnum subsecundum M A En 100
> 2 Sphagnum denticulatum M A En 200
> 3 Molinia caerulea M A En 300
> 4 Sphagnum flexuosum M A En 400
> 5 Juncus squarrosus M A En 500
> 6 Carex echinata M A En 600
>
> I do need a new one with a new factor constructed from a concatenation of the two first columns, genus and species. I am guessing this must be a simple matter while working with R, but I am stuck at this point.

veg$genus.species <- paste(veg$genus,veg$species)

will add a new column combining genus and species.

-- 
Manuel A. Morales
http://mutualism.williams.edu

______________________________________________ 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 Sun Dec 31 14:11:27 2006

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 31 Dec 2006 - 03:30:24 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.