hello! ive come across the following problem:
im writing a function to ease the production of maps. as my tables have
headers, id like to include an option in my function header to pass
these columns to use them inside the evaluation block. the function
looks as follows:
# maptable #the name of the table containing coordinates and columns for
measured values
# value: which column of my table to use (e.g. Alt, slope, us, etc...
# labels(maptable)
# [1] "pos.e" "pos.n" "Alt" "slope" "us" "uus" "lc"
make.map<-function (maptable,value)
{
pos.e<-maptable$pos.e #calling the column directly works
pos.n<-maptable$pos.n #calling the column directly works
key<-maptable$value #this doesnt work. output: NULL
... rest of function, irrelevant to my question
}
for example, i call the function by:
make.map(elevation,Alt,"Altitude","Sightings")
and my interp from akima package denies work, since key is NULL
interp(pos.e,pos.n,key,...)
have i just missed something? ive browsed the help pages and the
archive, looked into crawleys R book but didnt find any solution, though
im pretty sure this should be achievable!
______________________________________________
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.