[R] as.list.matrix

Kjetil Brinchmann Halvorsen kjetil at acelerate.com
Fri Oct 29 13:54:00 CEST 2004


Prof Brian Ripley wrote:

>On Fri, 29 Oct 2004, Peter Alspach wrote:
>
>  
>
>>Kjetil
>>
>>Isn't a data.frame as special type of list, and thus one could use
>>as.data.frame?
>>    
>>
>
>Yes, or
>
>   split(mat, col(mat))
>
>works.  So simple it hardly needs an as.list method.
>  
>
Thanks! I thought about split(), bit did'nt know col()

>
>  
>
>>Peter Alspach
>>
>>
>>    
>>
>>>>>Kjetil Brinchmann Halvorsen <kjetil at acelerate.com> 29/10/04
>>>>>          
>>>>>
>>    
>>
>
>Daily??  You created the matrix in the first place: why not create a data
>frame instead - na.omit was written for data frames?  And surely do.call
>is overkill for a 2-column matrix, and there seems a surplus c() in there.
>
>m <- na.omit(cbind(VRS$Tmed, resid(VRS.mod1,type="response"))
>scatter.smooth(m[,1], m[, 2], xlab="", ylab="")
>
>is much easier to follow.
>
>But do you need this?  The strange thing is that loess.smooth seems to 
>have been written expecting missing values, but does not work with them.
>It is easy to fix.
>  
>
That would be nice. What made this necessary was that scatter.smooth 
did'nt accept
NA's

Kjetil

>
>  
>


-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
               --  Mahdi Elmandjra




More information about the R-help mailing list