Hi,
I have a data frame which looks like :
There are around 200 rows.
The data frame can have additional month columns i.e. Mar_V Mar_S - I don't know this in advance. All I know is that the columns will arrive in pairs i.e. _V and _S.
I need to loop through the column pairs and put each pair of _V and _S into an array of 2 column matrices
The data is held in : data
I've tried the following
I get an error : newshape not found
It it possible to store an array of matrix's?
I have a data frame which looks like :
PHP:
Jan_V Jan_S Feb_V Feb_S
1 100 90 120 110
2 123 88 112 120
3 121 89 134 130
The data frame can have additional month columns i.e. Mar_V Mar_S - I don't know this in advance. All I know is that the columns will arrive in pairs i.e. _V and _S.
I need to loop through the column pairs and put each pair of _V and _S into an array of 2 column matrices
The data is held in : data
I've tried the following
PHP:
width <- c(ncol(data) -2)
x <-1
for (set in 1:width){
y <- x +1
newshape[set] <-cbind(data[, x], data[,y])
x <- x + 2
}
It it possible to store an array of matrix's?