# [R] error with persp()- increasing 'x' and 'y' values expected

Mon Feb 20 23:49:04 CET 2012

```On Feb 20, 2012, at 2:15 PM, adick wrote:

code produces the same error.) You may want to use rep with each and
times arguments to construct a regular grid and then population the
missing entries in  matrix with NA's.

Yes, there are missing entries. I don't know what rep and times arguments
are or how to do anything you just said, because I'm knew to R.

I did however figure out how to take the average of my three replicates and
try to plot that, which returns the same error. Here is the updated code:

bob= scan ("SBA3dataTaxonB.txt",what="char")
labels = bob[1:3]
bob=bob[-c(1,2,3)]
bob=as.numeric(bob)
bob=array(bob,dim=c(3, length(bob)/3))
bob=t(bob)
data.frame(bob) -> bob
vary=0
varx= 0
varz=0

for (r in 1:(length(bob[,1])/3)) {
vary[r] <- mean(bob[(1+((r-1)*3)):(3+((r-1)*3)),2])
varx[r] <- bob[(1+((r-1)*3)),1]
varz[r] <- bob[(1+((r-1)*3)),3]
}
rob <- data.frame(varx=varx,varz=varz,vary=vary)

rob = rob[order(rob[,1], rob[,2]),]
persp(rob[,1], rob[,2], rob[,3], log="rob[,1]")

--
View this message in context: http://r.789695.n4.nabble.com/error-with-persp-increasing-x-and-y-values-expected-tp4404834p4405380.html
Sent from the R help mailing list archive at Nabble.com.

```