Displaying 2 results from an estimated 2 matches for "cohercing".
Did you mean:
coercing
2003 Aug 14
2
vectorization question
...Andy
> -----Original Message-----
> From: Alberto Murta [mailto:amurta at ipimar.pt]
> Sent: Thursday, August 14, 2003 12:50 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] vectorization question
>
>
> Dear all
>
> I recently noticed the following error when cohercing a
> data.frame into a
> matrix:
>
> > example <- matrix(1:12,4,3)
> > example <- as.data.frame(example)
> > example$V4 <- 0
> > example
> V1 V2 V3 V4
> 1 1 5 9 0
> 2 2 6 10 0
> 3 3 7 11 0
> 4 4 8 12 0
> > example <...
2007 Jan 26
2
%*% in Matrix objects
Dear R users,
I need to normalize a bunch of row vectors. At a certain point I need to divide a matrix by a vector of norms. I find that the behavior of Matrix objects differs from normal matrix objects. Example the following code examples differ only in xnormed changing from normal to Matrix object:
x = matrix(1:12,3,4)
x = as(x, "CsparseMatrix")
xnorms = sqrt(colSums(x^2))