I have some matrices stored as elements in a list that I am working
with. On example is provided below as TP[[18]]
TP[[18]]
level2
level1 1 2 3 4
1 79 0 0 0
2 0 0 0 0
3 0 0 0 0
4 0 0 0 0
Now, using prop.table on this gives
prop.table(TP[[18]],1)
PM
Subject: [R] Replace missing values in lapply
I have some matrices stored as elements in a list that I am working
with. On example is provided below as TP[[18]]
TP[[18]]
level2
level1 1 2 3 4
1 79 0 0 0
2 0 0 0 0
3 0 0 0 0
4 0 0 0 0
Now, using
Perfect, thxs
-Original Message-
From: Dimitris Rizopoulos
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 24, 2007 10:49 AM
To: Doran, Harold
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Replace missing values in lapply
you need to return x in the function within lapply
I wonder if a list of matrices is the best representation?
Do your matrices all have the same dimension as in:
TP - list(matrix(c(1:3, NA), 2), matrix(c(NA, 1:3), 2))
# Then you could consider representing them as an array:
TPa - array(unlist(TP), c(2,2,2))
# in which case its just
need to walk through this and see what
turns up.
Thanks for the recommendation.
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 24, 2007 11:06 AM
To: Doran, Harold
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Replace missing values