Displaying 2 results from an estimated 2 matches for "coherced".
Did you mean:
coerced
2003 Aug 14
2
vectorization question
If you look at the structure, you'll see:
> x$V4 <- 0
> str(x)
`data.frame': 4 obs. of 4 variables:
$ V1: int 1 2 3 4
$ V2: int 5 6 7 8
$ V3: int 9 10 11 12
$ V4: num 0
Don't know if this is the intended result. In any case, you're probably
better off using data.matrix, as
> data.matrix(x)
V1 V2 V3 V4
1 1 5 9 0
2 2 6 10 0
3 3 7 11 0
4 4 8 12
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))