The OP may be interested in using low-level readBin() and writeBin()
instead. One can then either assign dimension attributes to the
object to access the data as a matrix/an array. Note that assigning
dimension attributes will probably(?) allocate a copy. If that is not
wanted, it is not that ha
What you might consider is to use save/load for storing the data in a
format that is easily accessible in R, and then using write.table for
creating a character based output for other external programs. For
the size files you are working with, this is the easiest and fastest
way of doing it.
On T
Apologies for my sarcastic/defensive reply email Peter.
The issue is that I need this matrix to be read into other programs - not
just R, so save() won't work. I like 'raw' mode because it saves so much
space, but it's difficult to work with. This read/write issue is but one
example; another is th
Johan,
My apologies if you took my comments to be sarcastic; they were
certainly not meant to be. I have no desire to put you or anyone
down.
I see now that you want to somehow store data more 'efficiently',
presumably in order to be able to handle larger objects in RAM.
I doubt that storage.mo
Why aren't you using 'save'/'load' to save a copy of the data? Why go
through all the conversions?
On Thu, Feb 11, 2010 at 2:50 PM, Rolf Turner wrote:
>
> On 12/02/2010, at 8:27 AM, Johan Jackson wrote:
>
>> "I suspect that you really don't know what 'raw' type means and haven't
>> bothered to c
On 12/02/2010, at 8:27 AM, Johan Jackson wrote:
> "I suspect that you really don't know what 'raw' type means and haven't
> bothered to check ?raw. It's also pretty clear that you haven't read the
> colClasses description in ?read.table very carefully."
>
> Gee, thanks Peter (this is what I love
"I suspect that you really don't know what 'raw' type means and haven't
bothered to check ?raw. It's also pretty clear that you haven't read the
colClasses description in ?read.table very carefully."
Gee, thanks Peter (this is what I love about the R help boards: people whose
sole goal is to put o
Johan Jackson wrote:
Hi Don and all,
I guess we're getting somewhere. Thanks. The file (first three columns,
first five rows) looks like this:
X10 X20 X30
00 0001
00 02 02
00 00 00
00 01 01
00 00 00
I guess R is reading 00 as a character? But here's the weird thing: this
dat
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Greg Snow
> Sent: Thursday, February 11, 2010 11:06 AM
> To: Johan Jackson; Don MacQueen
> Cc: r-help@r-project.org
> Subject: Re: [R] trouble with read.tabl
n MacQueen
> Cc: r-help@r-project.org
> Subject: Re: [R] trouble with read.table and colClasses='raw'
>
> Hi Don and all,
>
> I guess we're getting somewhere. Thanks. The file (first three columns,
> first five rows) looks like this:
>
> X10 X20 X30
> 00 00
Hi Ivan,
Thanks for the reply. Damn IT! My original post was screwed up. HERE is what
I did:
x <- read.table("data",header=TRUE,colClasses=rep('raw',60))
#returns error: no method or default for coercing "character" to "raw"
I've read the ?read.table and the colClasses argument. I'm still
Hi Don and all,
I guess we're getting somewhere. Thanks. The file (first three columns,
first five rows) looks like this:
X10 X20 X30
00 0001
00 02 02
00 00 00
00 01 01
00 00 00
I guess R is reading 00 as a character? But here's the weird thing: this
data (a raw matrix in R) w
The error message says there is no method for
converting from 'character' to 'raw'.
Apparently, R is seeing character data in the
file, and is trying to convert it to raw, since
you specified raw, and it can't.
See, for example,
as('aa','raw')
Error in as("aa", "raw") :
no method or defau
Well, it's too complicated for me! Here are what I would do (limited
since I'm still a newbie)
1) the syntax seems correct, it should work. The problem is somewhere
else, coming from your own file. Did you try skipping the colClasses
argument? To see how it looks like... If you can import it th
Hi!
|"colClasses| character. A vector of classes to be assumed for the
columns."
I'm not an R expert and I don't know what your "flat file raw" is, but
the colClasses argument is to define whether the column will be treated
as containing "factors", "logical", "integer" etc...
For more on
Hi all,
First off, it is surprising that there are no examples of how to use
read.table() under ?read.table !
I am trying to read in a flat file of type 'raw'. It has 1000 rows and 600K
columns. I have the RAM to accomplish this, but can't get the data into R
using read.table:
x <- read.table("d
16 matches
Mail list logo