[R] Paste a character to an object

Tim Clark mudiver1200 at yahoo.com
Sun Oct 4 04:26:12 CEST 2009


Dear List,

I can't seem to get a simple paste function to work like I need.  I have an object I need to call but it ends in a character string.  The object is a list of home range values for a range of percent isopleths.  I need to loop through a vector of percent values, so I need to paste the percent as a character on the end of the object variable.  I have no idea why the percent is in character form, and I can't use a simple index value (homerange[[1]]$polygons[100]) because there are a variable number of isopleths that are calculated and [100] will not always correspond to "100".  So I am stuck.

What I want is:

homerange[[1]]$polygons$"100"

What I need is something like the following, but that works:

percent<-c("100","75","50")
p=1
paste(homerange[[1]]$polygons$,percent[p],sep="")

Thanks for the help,

Tim



Tim Clark
Department of Zoology 
University of Hawaii




More information about the R-help mailing list