Displaying 20 results from an estimated 9000 matches similar to: "colClasses = "logical" produces all FALSE when input is 1/0"
2004 Jul 28
1
read.table() and NULL for colClasses
Hi,
is there are reason for not supporting NULL or "NULL" values for argument
colClasses in read.table(), much like you can use NULL values for argument
'what' in scan()? This would help quite a bit when reading large data files
where only a few columns are of interest.
I've modfied read.table() to so it calls scan(what=...) also with NULLs for
the fields to be skipped.
2009 Jun 14
2
read.csv
If read.csv's colClasses= argument is NOT used then read.csv accepts
double quoted numerics:
1: > read.csv(stdin())
0: A,B
1: "1",1
2: "2",2
3:
A B
1 1 1
2 2 2
However, if colClasses is used then it seems that it does not:
> read.csv(stdin(), colClasses = "numeric")
0: A,B
1: "1",1
2: "2",2
3:
Error in scan(file, what, nmax, sep,
2017 Oct 24
0
read.table(..., header == FALSE, colClasses = <vector with names attribute>)
>>>>> Benjamin Tyner <btyner at gmail.com>
>>>>> on Tue, 24 Oct 2017 07:21:33 -0400 writes:
> Jeff,
> Thank you for your reply. The intent was to construct a minimum
> reproducible example. The same warning occurs when the 'file' argument
> points to a file on disk with a million lines. But you are correct, my
>
2002 May 29
1
warning message for setAs when using class AsIs
This seemed too advanced for r-help and is related to the recent discussion of
character vectors in dataframes.
Following Brian Ripley's most excellent advice, we are moving to a world in
which character vectors in dataframes are always of class AsIs. The cool way of
doing this seemed to be the following:
> cat(c("x", "y", "z"), file = "test.txt",
2017 Oct 23
2
read.table(..., header == FALSE, colClasses = <vector with names attribute>)
Hello
I noticed that starting with R version 3.3.0 onward, this generates a
warning:
?? > txt <- c("a", "3.14")
?? > read.table(file = textConnection(txt), header = FALSE, colClasses
= c(x = "character", y = "numeric"))
the warning is "not all columns named in 'colClasses' exist" and I guess
the change was made in response
2017 Oct 24
2
read.table(..., header == FALSE, colClasses = <vector with names attribute>)
Jeff,
Thank you for your reply. The intent was to construct a minimum
reproducible example. The same warning occurs when the 'file' argument
points to a file on disk with a million lines. But you are correct, my
example was slightly malformed and in fact gives an error under R
version 3.2.2. Please allow me to try again; in older versions of R,
?? > read.table(file =
2017 Oct 24
0
read.table(..., header == FALSE, colClasses = <vector with names attribute>)
You are constructing the equivalent of a two-line data file, and complaining that it is not treating it like it was one line. If it did used to accept this silently [skeptical] then I for one am glad it produces a warning now.
--
Sent from my phone. Please excuse my brevity.
On October 23, 2017 2:53:21 PM PDT, Benjamin Tyner <btyner at gmail.com> wrote:
>Hello
>
>I noticed that
2019 Mar 27
3
[RFC] readtable enhancement
This has some nice properties:
1) It self-documents the input expectations in a similar manner to
colClasses.
2) The implementation could eventually "push down" the coercion, e.g.,
calling it on each chunk of an iterative read operation.
The implementation needs work though, and I'm not convinced that coercion
failures should fallback gracefully to the default.
Feature requests
2019 Mar 22
3
[PATCH 1/2] readtable: add hook for type conversions per column
This commit adds a function parameter to readtable. The function is called
for every column.
The goal is to allow specific (non-standard) type conversions depending on the input.
When the parameter is not given, or the function returns NULL, the legacy default applies.
The colClasses parameter still takes precedence, i.e. the colConvertFn only applies to
the default conversions.
This allows to
2012 Sep 14
1
Any way to get read.table.ffdf() (in the ff package) to pass colClasses or comment.char parameters through to read.fwf() ?
Hi everyone, my apologies if I'm overlooking something obvious in the
documentation. I'm relatively inexperienced with the (awesome) ff package.
My goal is to use the read.table.ffdf() function to call the read.fwf()
function and pass through the colClasses and comment.char arguments. The
code below shows exactly what doesn't work for me.
If the colClasses and comment.char
2004 Sep 08
1
A couple of issues with colClasses/setAs
Consider this:
$ cat test.dat
1 a
2 b
Now, we want to read the 2nd column as a factor and ignore the first
(since it's just a sequential ID). We can't just put "factor" among
the colClasses (would have been nice), so let's try this instead
> setAs("character","factor",as.factor)
Arguments in definition changed from (x) to (from)
>
2006 Sep 26
2
colClasses: supressed 'NA'
Hi,
The colClasses seem to be supressing 'NA' vlaues. How do I fix this?
R script and first 5 lines of output is below.
File "test2.dat" has blanks that are read as "NA" when I do not use
'colClasses', but as blanks when I use 'colClasses'.
temp.df <- read.fwf("test2.dat", width=c(10,1,1,1,1,2,2,3,3,1),
2002 Jul 10
1
bug in all.equal.character (PR#1767)
There is a bug in all.equal.character:
> all.equal.character(c("A", "B", "C"), c("A", "B", "C"))
[1] TRUE
> all.equal.character(c("A", "B", "C"), c("A", "B", NA))
Error in sum(out) : Object "out" not found
> traceback()
3: sum(out)
2: paste("`is.NA' value
2004 Oct 11
4
colClasses
Hi
I am trying to read a data frame from a text editor in to R. I want some
of the columns to be read in as "character" not numeric.
I figured that I can do that by using "colClasses" in "read.table"
command. However, I couldn't find out how to use
"colClasses". e.g. say I have 5 column in the data file. I want 1st and
3rd column to be read in as
2011 Nov 21
1
extending the colClasses argument in read.table
Hello,
We've released the int64 package to CRAN a few days ago. The package
provides S4 classes "int64" and "uint64" that represent signed and
unsigned 64 bit integer vectors.
One further development of the package is to facilitate reading 64 bit
integer data from csv, etc ... files.
I have this function that wraps a call to read.csv to:
- read the "int64"
2010 Feb 11
2
trouble with read.table and colClasses='raw'
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("data",header=TRUE,colClasses=rep(,600000))
#returns error: no method or
2005 Apr 18
2
colClasses = "Date" in read.delim, how to pass date-format?
Hi
I have a huge data-set with one column being of type date.
Of course I can import the data using this column as "factor" and then
convert it later to dates, using:
sws.bezuege$FaktDat <- dates(as.character(sws.bezuege$FaktDat),
format = c(dates = "d.m.y"))
But the conversion requires a huge amount of memory (and time),
therefore I would
2006 Jun 21
5
colClasses
Hi Folks!
I'm reading in some data from a .csv file that has a date column.
How do I use colClasses to get read.csv to recognize the date column?
The documentation on this seems to be nil -
And yes, I've read help and R Data Import/Export and can't figure out
what the colClasses syntax is.
Thanks,
john
[[alternative HTML version deleted]]
2007 Oct 09
1
Read in date fomat while colClasses="character"
Hi R users,
I am using xlsReadWrite to read a particular excel file. In one of the
columns I have dates ( say col=5). Now date column is read by default as
numeric. So I used dateTimeAs= "isodatetime". This enables reading in
the date format. However in the earlier column (say col=1) I have data
which however starts from row 10. So to read data from column one I use
2006 Mar 16
4
excluding factor levels with read.table() and colClasses=
Hi,
I am reading a "|" delimited text file into R using read.table(). I am
using colClasses= to specify some variables as factors. Some of these
variables include missing values coded as "NA". Unfortunately the R code
I am using (pasted bellow) includes "NA" as one of the factor levels. Is
it possible to remove the "NA" level from a factor with in