multidimensional array - in R Add an additional variable to a matrix -


i have big data set xyz , 2 other vaiables want plot them in way can make 3d slides out of data 4th (and later 5th) variable color index.

i trying use slice3d package plot3d data not in correct form , can't figure out how organise data. code want use:

library(plot3d) slice3d(x = x, z = z_nap, y = y, colvar = ampl,          ys = 1:10, zs = null, nacol = "black",          expand = 0.4, theta = 45, phi = 45) 

the data looks this:

x=c(53024.14,53024.14,63024.14,53024.14,53024.14,53023.98,53023.98,53023.98,53023.98, 53023.98,63023.98) y=c(403100.1,403100.1,403100.1,403100.1,403100.1,403100.2,403100.2,403100.2,403100.2,403100.2,403100.2) z_nap=c(-2.2695537,-2.5505537,-2.7335537,-2.9175537,-3.2265537,1.1271519,0.9331519,0.6431519,0.4791519,0.2951519,0.0251519) ampl=c(7196,195,5103,4537,6763,1207,2059,14121,26126,11850,9883) 

i sorted xyz data interp because have same values x , y while z changing.

s100<-interp(x, y, z, xo=seq(min(x), max(x), length=30),               yo=seq(min(y), max(y), length=30), duplicate="mean") 

i have matrix of xy z values in it. need make matrix containing xyz , other variable.

i've got matrix:

dim(s100$z) 30 30  

and need ampl 30 30 30


Comments