- #1
ProPatto16
- 326
- 0
Hi Readers,
I seem to have hit an elementary snag while fiddling in R...
i have a 5x5m surface interpolated at intervals of 0.01... giving 250,000 squares in my grid. i have roughly 20-30 xy cords where i want to retrieve the z value out of the data frame. does anyone know how to search an x y z data frame using the x and y cord?okay so I've figured it out using subset...
but the problem is out of the 250000 rows in the dataframe i want my 20-30 extracted. but the x and y values for the points i want extracted are stored as vectors.. so i need to figure out how to apply subset using vectors.
by doing
row<-subset(dataframe, x==1.05 & y==0.25)
that retrieves the correct row with those x and y values...
but say i have vectors of equal length for the x and y values i want stored in xt and yt then doing this
row<-subset(dataframe, x==xt & y==yt)
results in
[1] x y Height
<0 rows> (or 0-length row.names)
Is there a way i can apply subsetting using vectors for the x and y values i want to extract?thanks
I seem to have hit an elementary snag while fiddling in R...
i have a 5x5m surface interpolated at intervals of 0.01... giving 250,000 squares in my grid. i have roughly 20-30 xy cords where i want to retrieve the z value out of the data frame. does anyone know how to search an x y z data frame using the x and y cord?okay so I've figured it out using subset...
but the problem is out of the 250000 rows in the dataframe i want my 20-30 extracted. but the x and y values for the points i want extracted are stored as vectors.. so i need to figure out how to apply subset using vectors.
by doing
row<-subset(dataframe, x==1.05 & y==0.25)
that retrieves the correct row with those x and y values...
but say i have vectors of equal length for the x and y values i want stored in xt and yt then doing this
row<-subset(dataframe, x==xt & y==yt)
results in
[1] x y Height
<0 rows> (or 0-length row.names)
Is there a way i can apply subsetting using vectors for the x and y values i want to extract?thanks
Last edited: