[R] getting a new factor
Manuel Morales
Manuel.A.Morales at williams.edu
Sun Dec 31 04:04:35 CET 2006
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20061230/270b8505/attachment.bin
More information about the R-help
mailing list