---
> *From:* Bert Gunter
> *Sent:* Thursday, October 24, 2019 10:39
> *To:* Sebastien Bihorel
> *Cc:* r-help@r-project.org
> *Subject:* Re: [R] read.table and NaN
>
> Not so. Read ?read.table carefully. You can use "NA" as a default.
> Moreover, you
nter
Sent: Thursday, October 24, 2019 10:39
To: Sebastien Bihorel
Cc: r-help@r-project.org
Subject: Re: [R] read.table and NaN
Not so. Read ?read.table carefully. You can use "NA" as a default. Moreover,
you **specified** that you want NaN read as character, which means that any
c
>> read.table call accordingly. I am working on a framework that is meant to
>> process data files with unknown structure, so I have to think a bit more
>> about that...
>> --
>> *From:* Bert Gunter
>> *Sent:* Thursday, October 24, 2019 00:08
>> *To:* Se
a framework that is meant to
> process data files with unknown structure, so I have to think a bit more
> about that...
> --
> *From:* Bert Gunter
> *Sent:* Thursday, October 24, 2019 00:08
> *To:* Sebastien Bihorel
> *Cc:* r-help@r-project.org
> *Subj
Gunter
Sent: Thursday, October 24, 2019 00:08
To: Sebastien Bihorel
Cc: r-help@r-project.org
Subject: Re: [R] read.table and NaN
Like this?
con <- textConnection(object = 'A,B\n1,NaN\nNA,2')
> tmp <- read.table(con, header = TRUE, sep = ',', na.strings =
Like this?
con <- textConnection(object = 'A,B\n1,NaN\nNA,2')
> tmp <- read.table(con, header = TRUE, sep = ',', na.strings = '',
stringsAsFactors = FALSE,
+ colClasses = c("numeric", "character"))
> close.connection(con)
> tmp
A B
1 1 NaN
2 NA 2
> class(tmp[,1])
[1] "num
Hi,
Is there a way to make read.table consider NaN as a string of characters rather
than the internal NaN? Changing the na.strings argument does not seems to have
any effect on how R interprets the NaN string (while is does not the the NA
string)
con <- textConnection(object = 'A,B\n1,NaN\nNA,
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,
ints 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 = textConnection("a\t3.14"), head
sion 3.2.2. Please allow me to try again; in older versions of R,
> read.table(file = textConnection("a\t3.14"), header = FALSE,
colClasses = c(x = "character", y = "numeric"), sep="\t")
V1 V2
1 a 3.14
(with no warning). As of version 3
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, 201
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 gues
On Wed, 19 Oct 2016, Duncan Murdoch wrote:
I don't get that from those 9 observations, so there's likely something
else going on further down in the file.
Duncan,
Sigh. I thought I had removed all 'T's (for trace amounts) from the file,
but I hadn't.
Yes, this explains it.
Many thanks,
> On Oct 19, 2016, at 4:12 PM, David Winsemius wrote:
>
>
>> On Oct 19, 2016, at 1:54 PM, Rich Shepard wrote:
>>
>> The file, daily_records.dat, contains these data:
>>
>> "station","date","amount"
>> "0.3E",2014-01-01,
>> "0.3E",2014-01-02,
>> "0.3E",2014-01-03,0.01
>> "0.3E",2014-01-04,0.0
> On Oct 19, 2016, at 1:54 PM, Rich Shepard wrote:
>
> The file, daily_records.dat, contains these data:
>
> "station","date","amount"
> "0.3E",2014-01-01,
> "0.3E",2014-01-02,
> "0.3E",2014-01-03,0.01
> "0.3E",2014-01-04,0.00
> "0.3E",2014-01-05,0.00
> "0.3E",2014-01-06,0.00
> "0.3E",2014-01-
On 19/10/2016 4:54 PM, Rich Shepard wrote:
The file, daily_records.dat, contains these data:
"station","date","amount"
"0.3E",2014-01-01,
"0.3E",2014-01-02,
"0.3E",2014-01-03,0.01
"0.3E",2014-01-04,0.00
"0.3E",2014-01-05,0.00
"0.3E",2014-01-06,0.00
"0.3E",2014-01-07,0.10
"0.3E",2014-01-08,0.2
The file, daily_records.dat, contains these data:
"station","date","amount"
"0.3E",2014-01-01,
"0.3E",2014-01-02,
"0.3E",2014-01-03,0.01
"0.3E",2014-01-04,0.00
"0.3E",2014-01-05,0.00
"0.3E",2014-01-06,0.00
"0.3E",2014-01-07,0.10
"0.3E",2014-01-08,0.22
"0.3E",2014-01-09,0.49
Using read.table(
On 01/04/2015 11:06, Prof Brian Ripley wrote:
On 01/04/2015 09:52, Thomas wrote:
Hi,
I believe you are looking for 'text connections': see the 'text'
argument to read.table() and ?textConnection.
Thanks, that's it !
__
R-help@r-project.org maili
On 01/04/2015 09:52, Thomas wrote:
Hi,
Is there a way to create "memory connections" in R which are valid
connections to read.table (and associated function)? By saying "memory
connection" I refer to something like a connection created from a simple
character object (of length 1) - instead of ha
Hi,
Is there a way to create "memory connections" in R which are valid
connections to read.table (and associated function)? By saying "memory
connection" I refer to something like a connection created from a simple
character object (of length 1) - instead of having the content in a
physical f
To which I will add, you could have tried
count.fields('test.dat', sep='$' )
which I expect would have given you 3,3,2,3, and hence a pointer to where
the problem is.
count.fields is mentioned in the "See Also" section of ?read.table
--
Don MacQueen
Lawrence Livermore National Laboratory
70
Hello,
You're missing a dollar sign: 2$$$5, not 2$$5.
Hope this helps,
Rui Barradas
Em 11-02-2015 14:53, Tim Victor escreveu:
All,
Assume we have data in an ASCII file that looks like
Var1$Var2$Var3$Var4
1$2$3$4
2$$5
$$$6
When I execute
read.table( 'test.dat', header=TRUE, sep='$' )
I, o
All,
Assume we have data in an ASCII file that looks like
Var1$Var2$Var3$Var4
1$2$3$4
2$$5
$$$6
When I execute
read.table( 'test.dat', header=TRUE, sep='$' )
I, of course, receive the following error:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
:
line 2 did n
Thanks!!
On Mon, Jan 26, 2015 at 5:23 PM, peter dalgaard wrote:
>
> > On 26 Jan 2015, at 23:10 , Duncan Murdoch
> wrote:
> >
> > read.table(, colClasses = "character")
> >
> > (You might want "factor" instead of character.)
>
> Or maybe not. I'd expect trouble with getting the levels set to
> c
> On 26 Jan 2015, at 23:10 , Duncan Murdoch wrote:
>
> read.table(, colClasses = "character")
>
> (You might want "factor" instead of character.)
Or maybe not. I'd expect trouble with getting the levels set to
c("C","A","G","T") for all columns.
Is this always one single line of CGAT? If so,
On 26/01/2015 4:52 PM, Brian Smith wrote:
> Hi,
>
> I had a table with 'T's in it. When I try to read the table, it replaces
> all the 'T's with TRUE. Is there a way that I can retain the Ts?
That only happens for columns which are all T. (You only have one row,
so every T gets converted.) The
Hi,
I had a table with 'T's in it. When I try to read the table, it replaces
all the 'T's with TRUE. Is there a way that I can retain the Ts?
thanks!
Sample table (test.txt):
xx1 xx2 0 0 2 2 A A G G A G A A C C G G G G G G A G A A A G A G A A G G A A
A G G G A G A G G G A G A G G G G G A G G G
much to learn.
/Henrik
>
> Stephen HK Wong
> Stanford, California 94305-5324
>
> - Original Message -
> From: Henrik Bengtsson
> To: Stephen HK Wong
> Cc: r-help@r-project.org
> Sent: Thu, 18 Sep 2014 18:33:15 -0700 (PDT)
> Subject: Re: [R] read.table() 1Gb
information on
documentation.
Stephen HK Wong
Stanford, California 94305-5324
- Original Message -
From: Henrik Bengtsson
To: Stephen HK Wong
Cc: r-help@r-project.org
Sent: Thu, 18 Sep 2014 18:33:15 -0700 (PDT)
Subject: Re: [R] read.table() 1Gb text dataframe
As a start, make sure
When working with datasets too large to fit in memory it is usually
best to use an actual database, read the data into the database, then
pull the records that you want into R. There are several packages for
working with databases, but 2 of the simplest are the RSQLite and
sqldf packages (installi
r code for the packages cstmr ,gRain,gRc,gRim,gRbase using probability models,
On Friday, September 19, 2014 7:05 AM, Henrik Bengtsson
wrote:
As a start, make sure you specify the 'colClasses' argument. BTW,
using that you can even go to the extreme and read one column at the
time, if it c
As a start, make sure you specify the 'colClasses' argument. BTW,
using that you can even go to the extreme and read one column at the
time, if it comes down to that.
To read a 10% subset of the rows, you can use R.filesets as:
library(R.filesets)
db <- TabularTextFile(pathname)
n <- nbrOfRows(d
Dear All,
I have a table of 4 columns and many millions rows separated by tab-delimited.
I don't have enough memory to read.table in that 1 Gb file. And actually I have
12 text files like that. Is there a way that I can just randomly read.table()
in 10% of rows ? I was able to do that using col
Hello Uwe & Others
Thanks for all your help, I figured out what the problem was. It wasn't
working with old R version. Once I updated it to the latest version, it
seemed to work.
Thank you
--
View this message in context:
http://r.789695.n4.nabble.com/Read-table-mucks-up-headers-tp4688742p468
ate: 19/04/2014 14:05
Subject: Re: [R] Read.table mucks up headers
On 19.04.2014 14:30, starter wrote:
> Hello Milan
>
> It had worked perfectly before, but now I am trying on a different text
file
> but using the trick you showed I just get the headers in the output and
Hello Uwe
I tried both the options you mentioned but all i get as output then is the
header line and the headers as "row.names" and "X."
--
View this message in context:
http://r.789695.n4.nabble.com/Read-table-mucks-up-headers-tp4688742p4689185.html
Sent from the R help mailing list archive a
On 19.04.2014 14:30, starter wrote:
Hello Milan
It had worked perfectly before, but now I am trying on a different text file
but using the trick you showed I just get the headers in the output and that
too as "row.names" and "X".
*code:*
corr <- read.table("E:/temp/corrosion
data.txt",header=
Hello Milan
It had worked perfectly before, but now I am trying on a different text file
but using the trick you showed I just get the headers in the output and that
too as "row.names" and "X".
*code:*
corr <- read.table("E:/temp/corrosion
data.txt",header=T,fileEncoding="UTF-8-BOM")
> dput(corr
Thank you Milan, the fileEncoding bit worked perfectly.
From: Milan Bouchet-Valat
To: Jeff Newmiller
Cc: Pavneet Arora/UK/RoyalSun@RoyalSun, r-help@r-project.org,
pavnee...@yahoo.co.uk
Date: 14/04/2014 18:03
Subject:Re: [R] Read.table mucks up headers
Le lundi 14
Le lundi 14 avril 2014 à 08:50 -0700, Jeff Newmiller a écrit :
> You have not posted the input to your code so it is not reproducible.
> Also, you have posted in HTML, which is notorious for corrupting R
> code and data in emails.
>
> If I were to guess, though, it looks to me like you are workin
> But for some reason my first header comes as "?...X. ", instead of just "X".
> Can some one please tell me why? And how to fix it?
i) What were the separator characters in the original data file header row?
ii) Your first character is not being decoded properly; check the file encoding
and set
You have not posted the input to your code so it is not reproducible. Also, you
have posted in HTML, which is notorious for corrupting R code and data in
emails.
If I were to guess, though, it looks to me like you are working with a UTF-8
file with a Byte Order Mark (header). I don't know the "
Hey All
I am trying to read in a small text file using read.table.
dput(sim)
structure(list(ï...X. = 1:7, Y1 = c(2.5501, 4.105, 5.4687, 7.0009,
8.5066, 9.785, 11.5167), Y2 = c(2.5501, 4.105, 5.4687, 11.0009,
8.5066, 9.785, 11.5167), Y3 = c(2.5501, 4.105, 5.4687, 7.0009,
8.5066, 9.785, 15.516
> -Original Message-
> I have a txt file to read into R. The size of it is about 500MB.
> This txt file is produced by calling write.table(M, file =
> "xxx.txt"), where M is a large matrix After running MM =
> read.table("xxx.txt"), the R gui keeps a cpu core/thread
> fully occupied
Jie gmail.com> writes:
[snip]
> I have a txt file to read into R. The size of it is about 500MB.
> This txt file is produced by calling write.table(M, file =
> "xxx.txt"), where M is a large matrix
> After running MM = read.table("xxx.txt"), the R gui keeps a cpu
> core/thread fully occupied fo
Hi!
I think you have problem with "flag_var". I suggest to put just
"flagvar". Do not use "_" in variable names. I would suggest not to
use both "_" or "-" anywhere in data file. I am just a beginner with R
but think that is the problem...
Cheers!
Tanja.
On Sat, Dec 8, 2012 at 8:29 PM, Prof Brian
ember 08, 2012 1:11 PM
> To: Muhuri, Pradip (SAMHSA/CBHSQ); r-help@r-project.org
> Subject: [R] read.table()
>
>
> Hi List,
>
> I have spent more than 30 minutes, but failed to read in this file
> using the read.table() function. I could not figure out how to fix the
On 08/12/2012 19:10, Muhuri, Pradip (SAMHSA/CBHSQ) wrote:
Hi List,
I have spent more than 30 minutes, but failed to read in this file using the
read.table() function. I could not figure out how to fix the following error.
Well, we have a whole manual on this, mentioned on ?read.table (see Se
Hi List,
I have spent more than 30 minutes, but failed to read in this file using the
read.table() function. I could not figure out how to fix the following error.
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 1 did not have 6 elements
Any help would be
Hi
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of li1127217ye
> Sent: Monday, November 19, 2012 8:08 AM
> To: r-help@r-project.org
> Subject: Re: [R] read.table
>
> > read.table("data.
On 19.11.2012 08:07, li1127217ye wrote:
read.table("data.txt",header=TRUE,
colClasses=c("character","character","numeric","character",
"numeric","numeric"))
a b c d e f
1 SPX LSZ 100 C 0 34.40
2 SPX LSZ 100 P 0 1.30
3 SPX LSZ 105 C 0 30.30
4 SPX LSZ 105 P 0 1.85
5 SPX LSZ 110 C
> read.table("data.txt",header=TRUE,
colClasses=c("character","character","numeric","character",
"numeric","numeric"))
a b c d e f
1 SPX LSZ 100 C 0 34.40
2 SPX LSZ 100 P 0 1.30
3 SPX LSZ 105 C 0 30.30
4 SPX LSZ 105 P 0 1.85
5 SPX LSZ 110 C 0 26.40
It's right result! "header=TRUE",no
On Wed, 1 Aug 2012, William Dunlap wrote:
An unmatched quote can make read.table run very slowly when there are lots
of lines in the file. E.g.,
Bill,
Yes. Turns out that there was no closing quote on a changed header. I
found this by an error message on one data file; the other data file
On Wed, 1 Aug 2012, Rich Shepard wrote:
What might cause this?
Must be computers acting like computers. Restored files from backup, made
changes one at a time, and there are no problems reading them into R data
frames. My apologies for taking up space here.
Rich
__
te final line found by readTableHeader ...".
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Rich Shepard
> Sent: Wednesday, August 01, 2012 10:52 AM
>
On Wed, 1 Aug 2012, Rich Shepard wrote:
What might cause this?
I restored these two files from last Friday and they are read into R with
no problems. So, I'll make one change at a time and see where things break.
Will post results when I have them.
Rich
___
Yesterday I changed the headers for a couple of columns in data text files
and removed hyphens from within character strings, too. When I tried to
re-read these data sources using read.table() I encountered an issue I've
not before seen. Both files were read almost instantly until yesterday's
wo
s. It works very good.Chi"
A.K.
- Original Message -
From: peter dalgaard
To: arun
Cc: kexinz ; R help
Sent: Friday, July 13, 2012 10:27 AM
Subject: Re: [R] read.table with numeric row names
On Jul 13, 2012, at 04:27 , arun wrote:
> Hello,
>
> I saw your reply in nabble.
stood from his email:
> ("Thanks. It works very good.Chi"
>
> A.K.
>
>
>
>
> - Original Message -
> From: peter dalgaard
> To: arun
> Cc: kexinz ; R help
> Sent: Friday, July 13, 2012 10:27 AM
> Subject: Re: [R] read.table with nu
Thanks all you guys' help!
--
View this message in context:
http://r.789695.n4.nabble.com/read-table-with-numeric-row-names-tp4636342p4636446.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://sta
nlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of kexinz
> Sent: Thursday, July 12, 2012 2:59 PM
> To: r-help@r-project.org
> Subject: Re: [R] read.table with numeric row nam
4
> names(x)
[1] "2.5" "3.6" "7.1" "7.9"
On Thu, Jul 12, 2012 at 2:50 PM, kexinz wrote:
> I have a text file like this
> 2.5 3.6 7.1 7.9
> 100 3 4 2 3
> 200 3.1 4 3 3
> 300 2.2 3.3 2
ot;\\1",colnames(dat1))
> dat1
> 2.5 3.6 7.1 7.9
> 100 3.0 4.0 2 3
> 200 3.1 4.0 3 3
> 300 2.2 3.3 2 4
> plot(colMeans(dat1)~as.numeric(names(dat1)),xlab="Column_Name",ylab="Column_Mean")
>
> A.K.
>
>
>
>
> -
_Name",ylab="Column_Mean")
>
> A.K.
>
>
>
>
> - Original Message -
> From: kexinz
> To: r-help@r-project.org
> Cc:
> Sent: Thursday, July 12, 2012 2:50 PM
> Subject: [R] read.table with numeric row names
>
> I have a text file like
2 3
200 3.1 4.0 3 3
300 2.2 3.3 2 4
plot(colMeans(dat1)~as.numeric(names(dat1)),xlab="Column_Name",ylab="Column_Mean")
A.K.
- Original Message -
From: kexinz
To: r-help@r-project.org
Cc:
Sent: Thursday, July 12, 2012 2:50 PM
Subject: [R] read.table with nume
Thanks Yasir, this helps a lot.
BTW, is there an R command to read just the first line of the file?
Yasir Kaheil wrote
>
> just do this:
> colnames(r)<-substr(colnames(r),2,nchar(colnames(r)))
>
> This will remove the X.
> Later when you want to use the headed to plot something, cast it as
> n
Thanks, but I don't want to specify the column names by hand, since I have a
lot of similar files.
arun kirshna wrote
>
> Hi,
>
> Try this:
>
> dat1<-read.table(text="
> 2.5 3.6 7.1 7.9
> 100 3 4 2 3
> 200 3.1 4 3 3
> 300 2.2 3.3 2 4
> ",sep="",header=TR
just do this:
colnames(r)<-substr(colnames(r),2,nchar(colnames(r)))
This will remove the X.
Later when you want to use the headed to plot something, cast it as numeric:
plot(colMeans(r)~as.numeric(colnames(r)))
-
Yasir Kaheil
--
View this message in context:
http://r.789695.n4.nabble.com/re
colnames(dat1)<-c(2.5,3.6,7.1,7.9)
#produce character column names
is.character(colnames(dat1))
[1] TRUE
is.numeric(colnames(dat1))
[1] FALSE
dat1
2.5 3.6 7.1 7.9
100 3.0 4.0 2 3
200 3.1 4.0 3 3
300 2.2 3.3 2 4
A.K.
- Original Message -
From: kexinz
To: r-help@r-project.o
I have a text file like this
2.5 3.6 7.1 7.9
100 3 4 2 3
200 3.1 4 3 3
300 2.2 3.3 2 4
I used "r <- read.table("a.txt", header=T)"
The row names becomes X2.5, X3.6... What I need is the row names are
numeric, so I c
Thanks and with
datlines <- as.data.frame(inp[( grep("", inp)[1]+5 ):(grep("",
inp)[1]-1)]);
I get the data as needed.
Thanks again
H.
- Original Message -
On Jun 14, 2012, at 10:23 AM, Halldór Björnsson wrote:
> Hi,
>
> I am trying to read in weather balloon data, where each file
Thanks,
even better
- Original Message -
On Jun 14, 2012, at 12:18 PM, Halldór Björnsson wrote:
> Thanks and with
>
> datlines <- as.data.frame(inp[( grep("", inp)[1]+5 ):(grep(" PRE>", inp)[1]-1)]);
>
I suggest this instead.
> read.fwf(textConnection(datlines), widths=rep(7,11))
V1
On Jun 14, 2012, at 12:18 PM, Halldór Björnsson wrote:
Thanks and with
datlines <- as.data.frame(inp[( grep("", inp)[1]+5 ):(grep("PRE>", inp)[1]-1)]);
Er, ... are you sure? I got a factorized mess when I did that.
> str(datlines)
'data.frame': 98 obs. of 1 variable:
$ inp[(grep("", i
On Jun 14, 2012, at 12:18 PM, Halldór Björnsson wrote:
Thanks and with
datlines <- as.data.frame(inp[( grep("", inp)[1]+5 ):(grep("PRE>", inp)[1]-1)]);
I suggest this instead.
> read.fwf(textConnection(datlines), widths=rep(7,11))
V1V2V3V4 V5 V6 V7 V8V9 V10
On Jun 14, 2012, at 10:23 AM, Halldór Björnsson wrote:
Hi,
I am trying to read in weather balloon data, where each file has a
header of fixed length and
a trailing section of a fixed length. The data section (the table)
is of variable length.
An example of the data is on:
http://weather
Hi,
I am trying to read in weather balloon data, where each file has a header of
fixed length and
a trailing section of a fixed length. The data section (the table) is of
variable length.
An example of the data is on:
http://weather.uwyo.edu/cgi-bin/sounding?region=naconf&TYPE=TEXT%3ALIST&YEAR
Thanks Peter.
In my case specifying the quote="\"" worked out fine with read.table().
-Sashi
On Fri, May 4, 2012 at 1:53 PM, peter dalgaard wrote:
>
> On May 4, 2012, at 08:16 , Rameswara Sashi Kiran Challa wrote:
>
> > Hi,
> >
> > I have a tab seperated file with 206 rows and 30 columns.
> >
On May 4, 2012, at 08:16 , Rameswara Sashi Kiran Challa wrote:
> Hi,
>
> I have a tab seperated file with 206 rows and 30 columns.
>
> I read in the file into R using read.table() function. I checked the dim()
> of the data frame created in R, it had only 103 rows (exactly half), 30
> columns.
read.delim calls read.table so any differences between the two are
caused by differences in the default values of some of the parameters.
Take a look at the help file ?read.table
read.table uses white space as separator; read.delim tabs
read.table uses " and ' as quotes; read.delim just "
e
Hi,
I have a tab seperated file with 206 rows and 30 columns.
I read in the file into R using read.table() function. I checked the dim()
of the data frame created in R, it had only 103 rows (exactly half), 30
columns. Then I tried reading in the file using read.delim() function and
this time the
The # is the default comment character in read.table(), but that can
easily be changed:
> tc <- textConnection(
+ "yes yes yes yes yes
+ yes yes yes yes yes
+ yes yes # yes yes"
+ )
> x <- read.table(tc, comment.char="")
> x
V1 V2 V3 V4 V5
1 yes yes yes yes yes
2 yes yes yes yes yes
3 yes y
use the 'comment.char' parameter of read.table
Sent from my iPad
On Mar 1, 2012, at 17:51, Rui Barradas wrote:
> Hello,
>
>>
>> The problem is that I get a the following error bacause anything after the
>> # is ignored.
>>
>> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.
Hello,
>
> The problem is that I get a the following error bacause anything after the
> # is ignored.
>
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
> :
> line 6 did not have 500 elements
>
> R thinks that line 6 has only 2 elements because of the #.
>
Use '
> * William Dunlap [2012-01-24 21:47:39 +]:
>
>> >> Oh, yeah, a reproducible example:
>> >>
>> >> read.csv from
>> >> =
>> >> a,b
>> >> 1,2
>> >> 3,4
>> >> 5,,6
>> >> 7,8
>> >> =
>> >> I want to be able to extract the data frame
>> >> a b
>> >> 1 1 1
> The previous line should be '
ith 2 fields only
> textLines <- readLines(tf)
> counts <- count.fields(textConnection(textLines), sep=",")
> read.table(text=textLines[counts == 2], header=TRUE, sep=",")
a b
1 1 2
2 3 4
3 7 8
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Ori
> * Duncan Murdoch [2012-01-24 16:00:14 -0500]:
>
> On 24/01/2012 3:45 PM, Sam Steingold wrote:
>> I get this error from read.table():
>> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
>>line 234 did not have 8 elements
>> The error is genuine (an extra field sep
On 25/01/12 09:45, Sam Steingold wrote:
I get this error from read.table():
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 234 did not have 8 elements
The error is genuine (an extra field separator between 1st and 2nd element).
1. is there a way to see this
Given your domain name, you might also get some use out of the
system() and system2() commands which allow the passing of strings to
the OS command line (and thus the use of tools like grep/sed/awk
within R)
E.g., an idiom I use pretty frequently for interactive data analysis:
(not really related,
On 24/01/2012 3:45 PM, Sam Steingold wrote:
I get this error from read.table():
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 234 did not have 8 elements
The error is genuine (an extra field separator between 1st and 2nd element).
1. is there a way to see
I get this error from read.table():
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 234 did not have 8 elements
The error is genuine (an extra field separator between 1st and 2nd element).
1. is there a way to see this bad line 234 from R without diving into t
On Fri, Jan 13, 2012 at 7:02 AM, Francisco wrote:
> Hello,
> I have a csv file with many variables, both characters and integers.
> I would like to load it on R and do some operations on integer variables,
> the problem is that R loads the entire dataset considering all variables as
> characters,
On Jan 13, 2012, at 7:02 AM, Francisco wrote:
Hello,
I have a csv file with many variables, both characters and integers.
I would like to load it on R and do some operations on integer
variables, the problem is that R loads the entire dataset
considering all variables as characters, instead
Hello,
I have a csv file with many variables, both characters and integers.
I would like to load it on R and do some operations on integer
variables, the problem is that R loads the entire dataset considering
all variables as characters, instead I would like that R makes the
distinction between
Thanks All!
On Thu, Dec 8, 2011 at 7:41 PM, Robert Baer wrote:
> Hello All,
> This works,
> results <- read.table("plink.txt",T)
>
> while this doesn't.
> results <- read.table("plink.txt")
>
> The T is the value for the second parameter which you show from the help
> file p
uot;X..Hydrogen" "Helium" "Lithium" "Beryllium" "Boron"
> > [6] "Carbon"
> >> tail(names(dat))
> > [1] "Sulfur.32""Chlorine.32" "Argon.32" "Potassium.32"
> > "C
Now this is interesting:
Here's a list of how long it took to read the same file in various versions
of R:
R version 2.10.1 (2009-12-14) 3.97
R version 2.12.0 (2010-10-15)24.53
R version 2.13.0 (2011-04-13)24.48
R version 2.14.0 (2011-10-31) 3.75
I think that the even numbered re
Hello All,
This works,
results <- read.table("plink.txt",T)
while this doesn't.
results <- read.table("plink.txt")
The T is the value for the second parameter which you show from the help
file printout you looked at to be header. Thus, you are writing in short
cut:
results
On 08/12/2011 3:28 PM, Pavan G wrote:
Hello All,
This works,
results<- read.table("plink.txt",T)
while this doesn't.
results<- read.table("plink.txt")
Make sure your data frame contains columns CHR, BP, and P
What does adding the "T" in read.table do? Which argument does this
correspond to?
Hello All,
This works,
results <- read.table("plink.txt",T)
while this doesn't.
results <- read.table("plink.txt")
Make sure your data frame contains columns CHR, BP, and P
What does adding the "T" in read.table do? Which argument does this
correspond to? I tried searching for it but didn't fin
t;> head(names(dat))
> > [1] "X..Hydrogen" "Helium" "Lithium" "Beryllium" "Boron"
> > [6] "Carbon"
> >> tail(names(dat))
> > [1] "Sulfur.32""Chlorine.32" "Argon.32
1 - 100 of 282 matches
Mail list logo