[R] Simple question about Lists

Gabor Grothendieck ggrothendieck at gmail.com
Thu Nov 2 12:19:14 CET 2006


Try this:

> L <- list(matrix(1:10, 10))
> L
[[1]]
      [,1]
 [1,]    1
 [2,]    2
 [3,]    3
 [4,]    4
 [5,]    5
 [6,]    6
 [7,]    7
 [8,]    8
 [9,]    9
[10,]   10

> plot(L[[1]])


If your object is somehow different then please display it like this:

   dput(x, control = "all")

where x is your object so we can reproduce it exactly.


On 11/2/06, Wee-Jin Goh <wjgoh at brookes.ac.uk> wrote:
> Hello,
>
> I know this must be a very simple problem, but I can't work it out
> from the documentation that is available. I've got a list of data I
> would like to plot (the weights of a single neuron that was trained
> using the neural package). The problem I'm encountering is that this
> set of weights, are in the form of a list.
>
>  > network$weigth[1]
> [[1]]
>              [,1]
> [1,] -0.04687623
> [2,] -0.54087443
> [3,] -1.68130221
> [4,] -0.82295266
> [5,]  1.60848361
> [6,]  1.55903277
> [7,]  0.29005900
> [8,]  1.24387657
> [9,] -0.05129092
> [10,] -1.22469042
> [11,] -2.64470326
> [12,]  0.10517494
> [13,]  1.87561741
> [14,]  1.93962447
> [15,]  0.99212323
> [16,]  0.46430803
> [17,] -0.31660246
> [18,] -0.81997588
> [19,]  0.22277782
> [20,]  0.97456769
> [21,]  0.46083111
> [22,]  1.46876956
> [23,] -0.19702465
> [24,] -0.34898054
> [25,]  1.22504724
>
> Now, I've tried as.vector to convert it to a vector for plotting.
> Doesn't work. Tried as.matrix, that too doesn't work. I've tried
> accessing individual elements, but that doesn't work as network$weigth
> [1] returns what seems to me is a matrix but it doens't act like a
> matrix.
>
> Any help would be much obliged.
>
> Wee-Jin
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list