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,
Because by default blank fields aren't considered to be missing in factors
but they are in integer vectors.
f1-factor(c(1,2,,3,4))
f1
[1] 1 2 3 4
Levels: 1 2 3 4
I think you can fix this by specifying na.strings=c(NA,)
On 26/09/06, Anupam Tyagi [EMAIL PROTECTED] wrote:
Hi,
The
Anupam Tyagi wrote:
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'.
Well, you say it should be
Uwe Ligges ligges at statistik.uni-dortmund.de writes:
Well, you say it should be a factor, hence is taken as a level.
And why not a level. Thanks for drawing my attention to it. It is common
mistake that is easy to slip attention. Thanks a lot. Anupam.
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
Kerpel, John [EMAIL PROTECTED] writes:
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
Peter:
Thanks - I'll try both approaches. The examples clear things up a bit.
John
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
Sent: Wednesday, June 21, 2006 3:04 PM
To: Kerpel, John
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R
Is this what you want:
x - date,value
+ 2006-5-5,1
+ 2006-5-10,2
+ 2006-5-20,3
+ 2006-5-30,4
y - textConnection(x)
z - read.csv(y, colClasses=c(POSIXct, 'integer'))
z
date value
1 2006-05-05 1
2 2006-05-10 2
3 2006-05-20 3
4 2006-05-30 4
On 6/21/06, Kerpel, John
Peter has already directly answered your question but in case
what you really want is a zoo time series object (applicable
if this is a time series) then see the example in ?read.zoo in the
zoo package. Also,
library(zoo); vignette(zoo)
gives info on zoo package.
On 6/21/06, Kerpel, John
Read.zoo did it! Thanks!
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 21, 2006 3:15 PM
To: Kerpel, John
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] colClasses
Peter has already directly answered your question but in case
what you really
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
On 4/18/05, Christoph Lehmann [EMAIL PROTECTED] wrote:
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),
You are confusing class Date (part of R) with class dates (part of
package chron). There is no as() method for class dates, so you can't
do this. You can read the column as character (not factor) and convert
later, but it sounds like the `huge amount of memory (and time)' is in
fact taken by
so what do you recommend: I just need to be able to sort a data.frame
according to the date entry, and e.g. compute differences between subsequent
dates. Shall I stay with dates (thanks for the hint about confusion of Date
and dates) or is there a better way for this kind of task?
thanks a lot
On Mon, 18 Apr 2005, Christoph Lehmann wrote:
so what do you recommend: I just need to be able to sort a data.frame
according to the date entry, and e.g. compute differences between subsequent
dates. Shall I stay with dates (thanks for the hint about confusion of Date
and dates) or is there a
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
On Mon, 11 Oct 2004 16:21:31 -0400, Kalaylioglu, Zeynep (IMS)
[EMAIL PROTECTED] wrote:
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.
When using colClasses you need to specify the types of all the
columns. So assuming the other columns are numeric data, you could set
colClasses = c(character, numeric, character, numeric, numeric)
-roger
Kalaylioglu, Zeynep (IMS) wrote:
Hi
I am trying to read a data frame from a text editor in
I would try.
colClasses=c(character,numeric,character,numeric,numeric)
/E
Kalaylioglu, Zeynep (IMS) wrote:
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
Kalaylioglu, Zeynep (IMS) [EMAIL PROTECTED] writes:
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
20 matches
Mail list logo