Hi Mikael,

you can use some of the functions in the RSAGA package to extract values from a file (grid/shapefile) or data.frame and attach them to a data.frame with point locations.

If I may assume that 'indata' is an grid, try any of

  pick.from.ascii.grid
  pick.from.saga.grid
  rsaga.add.grid.values.to.points

(Only the latter actually uses SAGA itself, the former are independent of SAGA. The pick.* functions work on data.frames, the rsaga.* on files.)

I 'indata' is a shapefile, try

  pick.from.shapefile

And if 'indata' is another data.frame, try

  pick.from.points

If you choose method="krige" in the pick.* functions, this is just a quick-and-dirty ordinary kriging that should work without problems on dense point data; it would be fun to plug a more intelligent automatic interpolation procedure into these functions...

I hope this helps...
  Alex


Mikael Carlsson wrote:
Dear readers,

I have one file look like
ew;ns;cu;zn
1234567;7654321;23.4;13.7
name indata
load with read.table command

another file look like
2;cu;zn
name parmlst
also load with read.table

I want to do as follows

cu.v <- as.vector(cu)
zn.v<- as.vector(zn)
but using a for loop, like

for (i in 1:2)
{
some good code for generating file name <- as.vector(some good code)
#cu and zn in file name extracting value for cu and zn from indata
}


I have try almost everyting, using
paste()
noquote()
but it won't work, can only extract cu not the value 23.4 in the as.vector operation this
noquote(paste(parmlst[[i+4]],".v",sep="")) <-
as.vector(eval(noquote(paste(parmlst[[i+4]]))))
Error in noquote(paste(parmlst[[i + 4]], ".v", sep = "")) <- as.vector(eval(noquote(paste(parmlst[[i + : could not find function "noquote<-"
- - - - - - - - - - - -
test.v <- as.vector(noquote(paste(parmlst[[i+4]])))
print(test.v)
[1] "zn"
when it should be 13.7

Running R 2.8.0 on Win NT


Regards,
Mikael


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Alexander Brenning
[EMAIL PROTECTED] - T +1-519-888-4567 ext 35783
Department of Geography and Environmental Management
University of Waterloo
200 University Ave. W - Waterloo, ON - Canada N2L 3G1
http://www.fes.uwaterloo.ca/geography/faculty/brenning/

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to