First, I should mention that I only started looking into R yesterday to use the PLS library. I imported my data from MATLAB with 'R.matlab' library. One of my matrices I managed to insert to a dataframe quite easily since it was a 1D vector. It showed as

my_1d_matrix ... num [1:205, 1] 124 138 38 76 155 ...

So, I did this:

> df <- data.frame(x = my_1d_matrix)

My other matrix however is 205x4096. And it shows like this in my workspace:

my_2d_matrix ... Large list (205 elements, 6.5 Mb)

How can I insert this as my second variable in the same dataframe? I am actually trying to copy the gasoline dataset from pls library, which has 'octane' as one variable and 'NIR' (60x401 matrix) as the second one. Then it is easy to perform pls-regression.

I want my 205x4096 matrix to be in the same format as the one given by:

> str(gasoline$NIR)

which is:

>AsIs [1:60, 1:401] -0.050193 -0.044227 -0.046867 -0.046705 -0.050859 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:60] "1" "2" "3" "4" ... ..$ : chr [1:401] "900 nm" "902 nm" "904 nm" "906 nm" ...

So the end result should be a dataframe similar to 'gasoline', where the first variable is my_1d_matrix and the second one is my_2d_matrix.