[R] write.matrix.csr data conversion

David Meyer meyerd at technikum-wien.at
Tue Nov 6 19:49:15 CET 2012


Dear Sam,

there is C-code related to *reading* in such a file, but in the internal 
libsvm-format, not the matrix.csr format.

There is no C-code for *writing* this to a file.

There is certainly a way to speed this up, but I am not likely to do 
this in the near future.

Best
David

On 2012-11-06 19:15, Sam Steingold wrote:
> David,
> thanks for adding the feature.
>
> read.matrix.csr and, especially, write.matrix.csr are extremely slow:
>
>       user    system   elapsed
>   8381.988  3810.396 12345.349
>
> for a 2797634 x 224 matrix I have to deal with.
>
> The help page
> http://rss.acs.unt.edu/Rdoc/library/e1071/html/read.matrix.csr.html
> says
>
> David Meyer (based on C/C++-code by Chih-Chung Chang and Chih-Jen Lin)
>
> is there any chance that you might consider replacing the R code with
> the original C/C++?
>
> Thanks a lot!
>
>
>> * David Meyer <qnivq.zrlre at jh.np.ng> [2012-08-27 22:57:17 +0200]:
>>
>> done, thanks for the suggestion.
>>
>> David
>>
>> On 2012-08-27 21:15, Sam Steingold wrote:
>>>> * jim holtman <wubygzna at tznvy.pbz> [2012-08-27 14:55:08 -0400]:
>>>>
>>>> Most likely when 'y' is converted to a dataframe (not sure what the
>>>> function 'write.matrix.csr' does since you did not say where you got
>>>> it),
>>>
>>> sorry,
>>> library(e1071)
>>>
>>>> '0' and '1' are converted to factors which probably show up as 1
>>>> and 2 in the file.
>>>
>>> sounds reasonable, thanks.
>>>
>>> David, could you please add an option `fac' to `write.matrix.csr',
>>> similar to `read.matrix.csr' which already accepts `fac'?
>>>
>>> thanks!
>>>
>

-- 
Priv.-Doz. Dr. David Meyer
Institut für Wirtschaftsinformatik

Fachhochschule Technikum Wien
Höchstädtplatz 5, 1200 Wien
T: +43 1 333 40 77-394
F: +43 1 333 40 77-99 394
E: david.meyer at technikum-wien.at
I: www.technikum-wien.at




More information about the R-help mailing list