[datatable-help] Error : incorrect number of dimensions

white1551 743642404 at qq.com
Fri Mar 17 12:39:09 CET 2017


Hi all,

I tried to run the following code, but at the end it says 'Error in k[, 1] :
incorrect number of dimensions'. I just copy-paste this code and have no
experience on programming.  Can any one tell me what's wrong and how to fix
it? Thanks in advance!

*x <- rbinom(1000, 8, 0.5)
y <- rbinom(1000, 8, 0.5)

k <- c(rep(0:8, times=9), rep(0:8, each=9))
K <- matrix(k, ncol = 2, byrow = FALSE)
z <- k[, 1] + k[, 2]

cdf <- rep(0.0, times = 81)

for(i in 1:81) {cdf[i] <- sum(x+y <= z[i])/1000}

scatterplot3d(k[, 1], k[, 2], cdf, highlight.3d = TRUE, col.axis = 'blue',
              mian='Plotting bivariate CDF', pch = 20, ylab = 'values of y',
xlab = 'values of x', 
              zlab = 'CDF of x+y')*



--
View this message in context: http://r.789695.n4.nabble.com/Error-incorrect-number-of-dimensions-tp4729807.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list