search for: examplematrix

Displaying 2 results from an estimated 2 matches for "examplematrix".

2009 Jan 20
1
Creating a Sparse Matrix from a Sparse Vector
Hello, I am working with a sparse matrix that is approx. 13,900 by 14,100. My goal is to select a row out of the matrix and create a new matrix with that row repeated 13,900 times without having to do any looping. Example: Starting Matrix: exampleMatrix 3 x 4 sparse Matrix of class "dgCMatrix" [1,] 1 . . . [2,] . 1 . 0.5 [3,] . . 1 .. New Matrix:.. newExampleMatrix 3 x 4 sparse Matrix of class "dgCMatrix" [1,] . 1 . 0.5 [2,] . 1 . 0.5 [3,] . 1 . 0.5 When I try the following I get a memory allocation error due to the size...
2008 Mar 13
2
Using loop numbers in write.csv
...my own, but as of yet...no dice. 1) Is there a way to use the loop number in naming things in R. Specifically I have a simulation that has two loops. I would like to be able to write out the results to a csv file after each iteration. something like: for (i in 1:10){ exampleMatrix <- matrix(runif(25, 0, 1),5, 5) write.csv(exampleMatrix, file = "resultsMatrix_i.csv") } Where I would get 10 csv files named resultsMatrix_1, resultsMatrix_2 ... resultsMatrix_10. 2) On a similar note is there a way to use the loop number when...