Suppose I have the following square, non-negative matrices
> g=matrix(c(0,2,4,0.25,0,0,0,0.6,0),3,3,byrow=T);
I want to create a list where this matrix is repeated multiple times. if I
do this brute force (manually), using
> env <- list(g,g,g)
works fine. Yields
[[1]]
[,1] [,2] [,3]
[1
Suppose I want to create a structure containing the following values:
0.8,0.9,1.0,1.1,1.2
If I use
env <- list(0.8,0.9,1.0,1.1,1.2)
then R returns
> env
[[1]]
[1] 0.8
[[2]]
[1] 0.9
[[3]]
[1] 1
[[4]]
[1] 1.1
[[5]]
[1] 1.2
But, if I try to 'save some key-strokes', and use
env <- list(seq(
Complete newbie to R -- struggling with something which should be pretty
basic. Trying to create a simple data set (which I gather R refers to as a
data.frame). So
> a <- c(1,2,3,4,5);
> b <- c(0.3,0.4,0.5,0,6,0.7);
Stick the two together into a data frame (call test) using cbind
> test <- dat
3 matches
Mail list logo