Skip to content

write.matrix.csr data conversion

9 messages · jim holtman, Sam Steingold, R. Michael Weylandt +1 more

#
0       1 
5194394   23487
$ cut -d' ' -f1 f | sort | uniq -c
  23487 2
5194394 1

i.e., 0 is written as 1 and 1 is written as 2.
why?
is there a way to disable this?
#
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), '0' and '1' are converted to factors which probably show up as 1
and 2 in the file.  Here is a quick example:
x
 0  1
12  8
'table' int [1:2(1d)] 12 8
 - attr(*, "dimnames")=List of 1
  ..$ x: chr [1:2] "0" "1"
'data.frame':   2 obs. of  2 variables:
 $ x   : Factor w/ 2 levels "0","1": 1 2  #<<- norice the 1 & 2 as the
values of the factors '0' & '1'
 $ Freq: int  12 8

        
On Mon, Aug 27, 2012 at 2:47 PM, Sam Steingold <sds at gnu.org> wrote:

  
    
#
sorry,
library(e1071)
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!
#
done, thanks for the suggestion.

David
On 2012-08-27 21:15, Sam Steingold wrote:

  
    
1 day later
#
Thanks, when will I be able to use the new code?
I just did install.packages("e1071") + library(e1071). no good.
do I need to restart R?
thanks!

  
    
#
install.packages by default goes to CRAN (the stable repository): if
you want the bleeding edge, install e1071 from R-forge (note you might
need a source install if the build bot hasn't gotten to it since the
update)

https://r-forge.r-project.org/R/?group_id=786

Cheers,
Michael
On Tue, Aug 28, 2012 at 5:04 PM, Sam Steingold <sds at gnu.org> wrote:
#
how often are stable released made?
weekly? monthly?
I am not prepared to learn much in that district yet.
I would be interested in something similar to install.package(), but not beyond.
this seems to imply that the changes I am interested in are not
available yet.
this seems to install the same 1.6 yet again.
why doesn't it check that this same version has already been installed?
#
On Tue, Aug 28, 2012 at 11:39 PM, Sam Steingold <sds at gnu.org> wrote:
At the discretion of the package maintainers and the CRAN maintainers.
There's an RSS feed (CRANberries) if you want to see what is being
updated when.
Source installs are generally easy: just add type = "source" to
install.packages() and you should be good to go. This should find
compilers and system headers if needed for that package. Packages that
link to libraries elsewhere on your machine can obviously be trickier
and should probably be done through your package manager if possible.
Yes, it seems that Prof Meyer hasn't pushed the changes to R forge
yet. I don't know if he makes his working repos available elsewhere.
install.packages() forces a new install as both the name and the help
file suggest. Perhaps you are looking for update.packages()?

Michael
#
I now did. (There are no other repositories).

David