try this:
mat <- data.matrix(read.table(
textConnection("85 .90 86 .89 87 .98 86 .87
88 .98 90 .78 88 .76 89 .56
90 .67 95 .67 89 .89 90 .87
91 .56 96 .87 90 .76 92 .98")))
closeAllConnections()
nc <- ncol(mat)
labs <- mat[, seq(1, nc, 2)]
vals <- mat[, -seq(1, nc, 2)]
lis <- split(c(vals,
Is this what you are after:
> x <- read.table(textConnection("85 .90 86 .89 87 .98 86 .87
+ 88 .98 90 .78 88 .76 89 .56
+ 90 .67 95 .67 89 .89 90 .87
+ 91 .56 96 .87 90 .76 92 .98"))
> closeAllConnections()
> odd <- seq(1, ncol(x), by=2)
> x.r <- range(x[,odd])
> # create large array starting from
Dear R users,
I have a matrix like
85 .90 86 .89 87 .98 86 .87
88 .98 90 .78 88 .76 89 .56
90 .67 95 .67 89 .89 90 .87
91 .56 96 .87 90 .76 92.98
each pair of columns present a variable name and next the value. I have
matrix with more than 500 rows and column.
Now I want to convert this matrix
3 matches
Mail list logo