Here is an example dataset:

ZoneCover.df<- data.frame(Value=c(1,2))
row.names(ZoneCover.df) <- c("Floodplain1.Tree", "Floodplain1.Shrub")


I want to Export the Row.Names to a column in the dataframe: 

ZoneCover.df$ID <- names(ZoneCover.df)

which yields this:

> ZoneCover.df
                  Value                ID
Floodplain1.Tree      1  Floodplain1.Tree
Floodplain1.Shrub     2 Floodplain1.Shrub


QUESTION:

How do I remove the .Tree and .Shrub extensions from the ZoneCover$ID
values?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Convert-Row-Names-to-data-frame-column-tp2300758p2300758.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to