Skip to content

what exactly is the dim of data set yarn in package "pls"?

5 messages · Jeff Newmiller, C W, William Dunlap

#
Perhaps what is wrong is that you need to learn when to use the str() function.

str(yarn)
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
C W <tmrsg11 at gmail.com> wrote:

            
#
Start by using str() to get an idea of the structure of this dataset

   > str(pls::yarn)
   'data.frame':   28 obs. of  3 variables:
    $ NIR    : num [1:28, 1:268] 3.07 3.07 3.08 3.08 3.1 ...
     ..- attr(*, "dimnames")=List of 2
     .. ..$ : NULL
     .. ..$ : NULL
    $ density: num  100 80.2 79.5 60.8 60 ...
    $ train  : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...

I.e., it contains 3 things, each with 28 observations: a 268-column
matrix of numbers, NIR, a numeric vector, density, and a logical
vector, train.  data.frames can contain matrices. They are not common,
but can be used for grouping purposes or because it is easier to
refer to NIR[,j] than paste(NIR, j, sep=".").

help(yarn) tells about the meaning of the components.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com