Displaying 2 results from an estimated 2 matches for "gridd".
Did you mean:
grid
2009 Apr 07
3
strange (?) behavoir of expand.grid()
...of one of my input variables - created by seq() - I
have to use strings (e.g ==".6") to select a row of the object
created by expand.grid(), for other values numerical (e.g. ==.8) and
for some both work. Please find an example below.
#Example
x<- seq(0,1,1/10)
y <- seq(0,1,1/10)
gridd <- expand.grid(x,y )
gridd[which( gridd[,2]=="0.6" ),] #gives me the right data
gridd[which( gridd[,2]==0.6 ) ,] #gives error message
gridd[which( gridd[,2]=="0.4" ),] #gives right data
gridd[which( gridd[,2]==0.4 ),] #gives right data
gridd[which( gridd[,2]=="...
2011 Oct 24
1
Adding points to a wireframe: 'x and units must have length >0' error
...message "error using packet 1, 'x' and
'units' must have length >0". Does anyone know what I'm doing wrong? The
code I've been using is:
# generate some fake data
data.frame(x = seq(-4, 0, 0.5), y = seq(0, 40, 5))-> df
expand.grid(x = df$x, y = df$y) -> gridd
(gridd$y* gridd$x) -> gridd$z
data.frame(x = runif(10, -4, 0), y = runif(10, 0, 40))-> pts1
pts1$z <- pts1$x*pts1$y
# plot
wireframe(z ~ y*x, gridd, drape = TRUE, colorkey= TRUE,
scales = list(arrows = FALSE),
pts = pts1,
panel.3d.wireframe =
func...