[R] read.table

2007-09-06 Thread Ingo Holz
Hi,

 I want to read a ascii-file using the function read.table.
 With 'skip' and 'nrows' I can select the rows to read from this file.

 Is there a way to select columns (in the selected rows)?

Thanks,

Ingo

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table

2007-09-06 Thread Peter Dalgaard
Ingo Holz wrote:
 Hi,

  I want to read a ascii-file using the function read.table.
  With 'skip' and 'nrows' I can select the rows to read from this file.

  Is there a way to select columns (in the selected rows)?
   
Yes, use the colClasses argument.
(I won't rewrite the help page here; I expect that you can read it once
you know where to look.)

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] read.table opening a website incl Password

2007-05-16 Thread Roland Rau
Dear all,

in the past I have been able to access websites with data directly. For 
example the following code works nicely

mydata - 
read.table(http://www.lifetable.de/data/MPIDR/POL_2004.txt;,   header=TRUE)

But what happens if I need a username and password (a different site)? 
How do I do that? Or is it not possible to this in R?
I tried something like this

mydata.frame - read.table(myusr:[EMAIL PROTECTED]/adir/afile.txt)

but it did not work.
I'd appreciate any hints.
My platform is Win32 (and I am actually running R 2.3.1, but I guess 
(hope!) this is not the reason. At least I checked the NEWS file whether 
any changes appeared since 2.3.1 which could affect this behavior).

Thanks,
Roland

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table opening a website incl Password

2007-05-16 Thread Chuck Cleland
Roland Rau wrote:
 Dear all,
 
 in the past I have been able to access websites with data directly. For 
 example the following code works nicely
 
 mydata - 
 read.table(http://www.lifetable.de/data/MPIDR/POL_2004.txt;, 
 header=TRUE)
 
 But what happens if I need a username and password (a different site)? 
 How do I do that? Or is it not possible to this in R?
 I tried something like this
 
 mydata.frame - read.table(myusr:[EMAIL PROTECTED]/adir/afile.txt)
 
 but it did not work.
 I'd appreciate any hints.
 My platform is Win32 (and I am actually running R 2.3.1, but I guess 
 (hope!) this is not the reason. At least I checked the NEWS file whether 
 any changes appeared since 2.3.1 which could affect this behavior).

  In what way did it not work?  The following seems to work for me:

read.table(ftp://myusr:[EMAIL PROTECTED]/mydir/test.dat)

 Thanks,
 Roland
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table opening a website incl Password

2007-05-16 Thread Prof Brian Ripley
On Wed, 16 May 2007, Roland Rau wrote:

 Dear all,

 in the past I have been able to access websites with data directly. For
 example the following code works nicely

 mydata -
 read.table(http://www.lifetable.de/data/MPIDR/POL_2004.txt;, 
 header=TRUE)

 But what happens if I need a username and password (a different site)?
 How do I do that? Or is it not possible to this in R?
 I tried something like this

 mydata.frame - read.table(myusr:[EMAIL PROTECTED]/adir/afile.txt)

 but it did not work.

Well, it could not.  You need ftp:// or http:// for this to be a URL. This 
ought to work for ftp:, but AFAIK not for http:.  You could always try 
--internet2: if it works in IE, it will probably also work in R.

 I'd appreciate any hints.
 My platform is Win32 (and I am actually running R 2.3.1, but I guess
 (hope!) this is not the reason. At least I checked the NEWS file whether
 any changes appeared since 2.3.1 which could affect this behavior).

 Thanks,
 Roland

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table opening a website incl Password

2007-05-16 Thread Bos, Roger
Chuck, Roland is trying to read from a web site instead of a ftp site.

I have also gotten this to work:
read.table(ftp://myusr:[EMAIL PROTECTED]/mydir/test.dat)
But when I try to do the same thing from the SEC's ftp site I get an
error, so beyond R, there may be some internet settings that need to be
fiddled with.  Maybe I can tag onto Roland's question and ask for hints
on what configuration options are available?

Thanks,

Roger


 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chuck Cleland
Sent: Wednesday, May 16, 2007 1:08 PM
To: Roland Rau
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] read.table opening a website incl Password

Roland Rau wrote:
 Dear all,
 
 in the past I have been able to access websites with data directly. 
 For example the following code works nicely
 
 mydata - 
 read.table(http://www.lifetable.de/data/MPIDR/POL_2004.txt;,
header=TRUE)
 
 But what happens if I need a username and password (a different site)?

 How do I do that? Or is it not possible to this in R?
 I tried something like this
 
 mydata.frame - 
 read.table(myusr:[EMAIL PROTECTED]/adir/afile.txt)
 
 but it did not work.
 I'd appreciate any hints.
 My platform is Win32 (and I am actually running R 2.3.1, but I guess
 (hope!) this is not the reason. At least I checked the NEWS file 
 whether any changes appeared since 2.3.1 which could affect this
behavior).

  In what way did it not work?  The following seems to work for me:

read.table(ftp://myusr:[EMAIL PROTECTED]/mydir/test.dat)

 Thanks,
 Roland
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

** * 
This message is for the named person's use only. It may 
contain confidential, proprietary or legally privileged 
information. No right to confidential or privileged treatment 
of this message is waived or lost by any error in 
transmission. If you have received this message in error, 
please immediately notify the sender by e-mail, 
delete the message and all copies from your system and destroy 
any hard copies. You must not, directly or indirectly, use, 
disclose, distribute, print or copy any part of this message 
if you are not the intended recipient.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table opening a website incl Password

2007-05-16 Thread Roland Rau
Dear all,

so far I tried various things but I did not really succeed:
- starting R with --internet2
- using url()
- using read.table(http://myusr:[EMAIL PROTECTED]/adir/afile.txt)

I just have an idea what the problem could be for me:
The username is actually an email address. So the '@'-character has some 
ambiguous meaning in my setting. Sorry that I did not think of that 
beforehand.

Thank you very much for your help,
Roland




Prof Brian Ripley wrote:
 On Wed, 16 May 2007, Roland Rau wrote:
 
 Dear all,

 in the past I have been able to access websites with data directly. For
 example the following code works nicely

 mydata -
 read.table(http://www.lifetable.de/data/MPIDR/POL_2004.txt;, 
 header=TRUE)

 But what happens if I need a username and password (a different site)?
 How do I do that? Or is it not possible to this in R?
 I tried something like this

 mydata.frame - read.table(myusr:[EMAIL PROTECTED]/adir/afile.txt)

 but it did not work.
 
 Well, it could not.  You need ftp:// or http:// for this to be a URL. 
 This ought to work for ftp:, but AFAIK not for http:.  You could always 
 try --internet2: if it works in IE, it will probably also work in R.
 
 I'd appreciate any hints.
 My platform is Win32 (and I am actually running R 2.3.1, but I guess
 (hope!) this is not the reason. At least I checked the NEWS file whether
 any changes appeared since 2.3.1 which could affect this behavior).

 Thanks,
 Roland

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] read.table

2007-04-24 Thread elyakhlifi mustapha
sorry,
I don't undersatnd what happens

Annee_O;Id_Essai;Id_Rep;Id_Geno;Id_Cult;Lib_Geno;St_Cult;Id_Par;X_Par;Y_Par;Id_Cara;Surf_O;Val_O;Ori_O;Stade_O;Date_O;Id_Bloc;Id_TrT1
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;137;;9.4;P;;09/09/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;193;;189;P;;01/01/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;103;14.95;85;P;;09/09/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;177;;55.1;P;;05/10/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;138;14.95;6.3;P;;09/09/2004;1;0
2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;308;;140;P;;05/08/2004;1;0
2004;1006003;1;55096;1012999;Dally/1;;2;2;1;137;;8.9;P;;09/09/2004;1;0
2004;1006003;1;55096;1012999;Dally/1;;2;2;1;193;;192;P;;01/01/2004;1;0
2004;1006003;1;55096;1012999;Dally/1;;2;2;1;103;14.95;87;P;;09/09/2004;1;0



that's the begining of my table and I'm trying to read it from R but I can't 
actually to read it I write this script

 donAP - read.table(C:/Documents and Settings/melyakhlifi/Mes 
 documents/feuilles 
 excel/copi_donnees3.csv,header=TRUE,sep=;,quote=,dec=.)
Erreur dans scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  
: 
la ligne 656 n'avait pas 18 éléments

there's some errors and I don't understand why?


  
___





[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table

2007-04-24 Thread Peter Dalgaard
elyakhlifi mustapha wrote:
 sorry,
 I don't undersatnd what happens

 Annee_O;Id_Essai;Id_Rep;Id_Geno;Id_Cult;Lib_Geno;St_Cult;Id_Par;X_Par;Y_Par;Id_Cara;Surf_O;Val_O;Ori_O;Stade_O;Date_O;Id_Bloc;Id_TrT1
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;137;;9.4;P;;09/09/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;193;;189;P;;01/01/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;103;14.95;85;P;;09/09/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;177;;55.1;P;;05/10/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;138;14.95;6.3;P;;09/09/2004;1;0
 2004;1006003;1;55094;1012988;XF 338/1;;1;1;1;308;;140;P;;05/08/2004;1;0
 2004;1006003;1;55096;1012999;Dally/1;;2;2;1;137;;8.9;P;;09/09/2004;1;0
 2004;1006003;1;55096;1012999;Dally/1;;2;2;1;193;;192;P;;01/01/2004;1;0
 2004;1006003;1;55096;1012999;Dally/1;;2;2;1;103;14.95;87;P;;09/09/2004;1;0



 that's the begining of my table and I'm trying to read it from R but I can't 
 actually to read it I write this script

   
 donAP - read.table(C:/Documents and Settings/melyakhlifi/Mes 
 documents/feuilles 
 excel/copi_donnees3.csv,header=TRUE,sep=;,quote=,dec=.)
 
 Erreur dans scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
  : 
 la ligne 656 n'avait pas 18 �l�ments

 there's some errors and I don't understand why?

   
The obvious question is what line 656 (+/- a couple of lines) actually
contains...

x - readLines(C:/Documents and Settings/melyakhlifi/Mes
documents/feuilles  excel/copi_donnees3.csv)
length(x)
x[656]
x[653:658] # (if long enough)

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table with more than one sep

2007-04-19 Thread Gabor Grothendieck
Try this:

# test data
Input - 4547;1970.01.01 00:00-1970.01.01 01:00;   noData
4547;1970.01.01 00:00-1970.01.01 01:00;   noData

# replace next line with Lines - readLines(myfile.dat)
Lines - readLines(textConnection(Input))

Lines - gsub([;-],  , Lines)
read.table(textConnection(Lines))



On 4/19/07, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 Dear List,

 somebody knows, if the following operation can be done in an easier way?

 The data rows which should be read into R look like that:

 4547;1970.01.01 00:00-1970.01.01 01:00;   noData

 Unitil now we are doing this procedure:

 1. Dividing columns which are separated by ;

 =  temp - read.table(file ,sep=';', na.strings='noData',
 strip.white=TRUE)
 = write(temp, temp.txt)

 2. Dividing colums which are separated by -

 =  temp - read.table(temp.txt ,sep='-', na.strings='noData',
 strip.white=TRUE)
 = write(temp, temp.txt)

 3. Dividing colums which are separated by  

 =  temp - read.table(temp.txt ,sep=' ', na.strings='noData',
 strip.white=TRUE)

 I can imagine that there should be a way to do this more efficient.

 Thanks for help in advance.

 Jan Schwanbeck

 University of Berne
 Institute of Geography

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table for a subset of data

2007-03-12 Thread Thaden, John J
Feng,
   I had the same question as you, how to read a subset of data, and the same
reaction as Wensui when I discovered that read.table could not.  Even if my
computer's memory were up to it, I am troubled by the idea of reading in 1.8
GB of data (in my case) to get just 4,000 numbers, for instance, particularly
if I'm then going to iterating through the entire dataset in 4,000-number
chunks.  
   I ended up defining a NetCDF format to hold my data using the RNetCDF
package, since that package's var.get.nc() function is perfectly able to read
subsets of a NetCDF variable.  Furthermore, NetCDF files allow data to be
matrices and even higher order arrays, from which you can then retrieve any
chunk by including var.get.nc 'start' and 'count' arguments in the form of
vectors of length equal to the number of array dimensions.  Once a NetCDF
format is defined, all else is painless.  One limitation is that the RNetCDF
package only supports version 3 of the NetCDF library, a version that puts a
2 GB limit on a variable's size.  Version 4 removes this limitation; I'm
hopeful some day that an R package will be an interface to the NetCDF version
4 library.
John Thaden

Message: 22
Date: Sun, 11 Mar 2007 21:33:04 -0500
From: jim holtman [EMAIL PROTECTED]
Subject: Re: [R] read.table for a subset of data
To: Wensui Liu [EMAIL PROTECTED]
Cc: r-help r-help@stat.math.ethz.ch
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain

If you know what 10 rows to read, then you can 'skip' to them, but it the
system still has to read each line at a time.

I have a 200,000 line csv file of numerics that takes me 4 seconds to read
in with 'read.csv' using 'colClasses', so I would guess your 100K line file
would take half of that.  Is 2 seconds of time a waste of resources?


On 3/11/07, Wensui Liu [EMAIL PROTECTED] wrote:

 Jim,

 Glad to see your reply.

 Refering to your email, what if I just want to read 10 rows from a csv
 table with 10 rows? Do you think it a waste of resource to read
 the whole table in?
 Anything thought?

 wensui

 On 3/11/07, jim holtman [EMAIL PROTECTED] wrote:
  Why cann't you read in the whole data set and then create the
 subsets?  This
  is easily done with 'split'.  If the data is too large, then consider a
 data
  base.
 
  On 3/11/07, gnv shqp [EMAIL PROTECTED] wrote:
  
   Hi R-experts,
  
   I have data from four conditions of an experiment.  I tried to create
 four
   subsets of the data with read.table, for example,
   read.table(Experiment.csv,subset=(condition==1))
   .  I found a similar post in the archive, but the answer to that post
 was
   no.   Any  new ideas about  reading subsets of data with read.table?
  
   Thanks!
  
   Feng
  
  [[alternative HTML version deleted]]
  

Confidentiality Notice: This e-mail message, including any a...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table for a subset of data

2007-03-12 Thread jim holtman
If you are iterating through the dataset 4000 numbers/lines at a time, you
can do this by opening the dataset as a connection and then
reading/processing 4000 lines at a time

myFile - open('dataset', 'r')
while (TRUE){
input - scan(myFile, what=0, n=4000)
if (length(input) == 0) break
.process the data
}

But if you want to randomly select which lines, then some type of database
is better.


On 3/12/07, Thaden, John J [EMAIL PROTECTED] wrote:

 Feng,
   I had the same question as you, how to read a subset of data, and the
 same
 reaction as Wensui when I discovered that read.table could not.  Even if
 my
 computer's memory were up to it, I am troubled by the idea of reading in
 1.8
 GB of data (in my case) to get just 4,000 numbers, for instance,
 particularly
 if I'm then going to iterating through the entire dataset in 4,000-number
 chunks.
   I ended up defining a NetCDF format to hold my data using the RNetCDF
 package, since that package's var.get.nc() function is perfectly able to
 read
 subsets of a NetCDF variable.  Furthermore, NetCDF files allow data to be
 matrices and even higher order arrays, from which you can then retrieve
 any
 chunk by including var.get.nc 'start' and 'count' arguments in the form of
 vectors of length equal to the number of array dimensions.  Once a NetCDF
 format is defined, all else is painless.  One limitation is that the
 RNetCDF
 package only supports version 3 of the NetCDF library, a version that puts
 a
 2 GB limit on a variable's size.  Version 4 removes this limitation; I'm
 hopeful some day that an R package will be an interface to the NetCDF
 version
 4 library.
 John Thaden

 Message: 22
 Date: Sun, 11 Mar 2007 21:33:04 -0500
 From: jim holtman [EMAIL PROTECTED]
 Subject: Re: [R] read.table for a subset of data
 To: Wensui Liu [EMAIL PROTECTED]
 Cc: r-help r-help@stat.math.ethz.ch
 Message-ID:
[EMAIL PROTECTED]
 Content-Type: text/plain

 If you know what 10 rows to read, then you can 'skip' to them, but it the
 system still has to read each line at a time.

 I have a 200,000 line csv file of numerics that takes me 4 seconds to read
 in with 'read.csv' using 'colClasses', so I would guess your 100K line
 file
 would take half of that.  Is 2 seconds of time a waste of resources?


 On 3/11/07, Wensui Liu [EMAIL PROTECTED] wrote:
 
  Jim,
 
  Glad to see your reply.
 
  Refering to your email, what if I just want to read 10 rows from a csv
  table with 10 rows? Do you think it a waste of resource to read
  the whole table in?
  Anything thought?
 
  wensui
 
  On 3/11/07, jim holtman [EMAIL PROTECTED] wrote:
   Why cann't you read in the whole data set and then create the
  subsets?  This
   is easily done with 'split'.  If the data is too large, then consider
 a
  data
   base.
  
   On 3/11/07, gnv shqp [EMAIL PROTECTED] wrote:
   
Hi R-experts,
   
I have data from four conditions of an experiment.  I tried to
 create
  four
subsets of the data with read.table, for example,
read.table(Experiment.csv,subset=(condition==1))
.  I found a similar post in the archive, but the answer to that
 post
  was
no.   Any  new ideas about  reading subsets of data with read.table?
   
Thanks!
   
Feng
   
   [[alternative HTML version deleted]]
   

 Confidentiality Notice: This e-mail message, including any attachments, is
 for the sole use of the intended recipient(s) and may contain confidential
 and privileged information.  Any unauthorized review, use, disclosure or
 distribution is prohibited.  If you are not the intended recipient, please
 contact the sender by reply e-mail and destroy all copies of the original
 message.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] read.table for a subset of data

2007-03-11 Thread gnv shqp
Hi R-experts,

I have data from four conditions of an experiment.  I tried to create four
subsets of the data with read.table, for example,
read.table(Experiment.csv,subset=(condition==1))
.  I found a similar post in the archive, but the answer to that post was
no.   Any  new ideas about  reading subsets of data with read.table?

Thanks!

Feng

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table for a subset of data

2007-03-11 Thread Wensui Liu
as far as I've know, I don't think you can do so with read.table. But
I am also thinking about RODBC and wondering if you could assign a DSN
to your .csv file and then use sql to fetch the subset.

On 3/11/07, gnv shqp [EMAIL PROTECTED] wrote:
 Hi R-experts,

 I have data from four conditions of an experiment.  I tried to create four
 subsets of the data with read.table, for example,
 read.table(Experiment.csv,subset=(condition==1))
 .  I found a similar post in the archive, but the answer to that post was
 no.   Any  new ideas about  reading subsets of data with read.table?

 Thanks!

 Feng

 [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 
WenSui Liu
A lousy statistician who happens to know a little programming
(http://spaces.msn.com/statcompute/blog)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table for a subset of data

2007-03-11 Thread jim holtman
Why cann't you read in the whole data set and then create the subsets?  This
is easily done with 'split'.  If the data is too large, then consider a data
base.

On 3/11/07, gnv shqp [EMAIL PROTECTED] wrote:

 Hi R-experts,

 I have data from four conditions of an experiment.  I tried to create four
 subsets of the data with read.table, for example,
 read.table(Experiment.csv,subset=(condition==1))
 .  I found a similar post in the archive, but the answer to that post was
 no.   Any  new ideas about  reading subsets of data with read.table?

 Thanks!

 Feng

[[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table for a subset of data

2007-03-11 Thread Wensui Liu
Jim,

Glad to see your reply.

Refering to your email, what if I just want to read 10 rows from a csv
table with 10 rows? Do you think it a waste of resource to read
the whole table in?
Anything thought?

wensui

On 3/11/07, jim holtman [EMAIL PROTECTED] wrote:
 Why cann't you read in the whole data set and then create the subsets?  This
 is easily done with 'split'.  If the data is too large, then consider a data
 base.

 On 3/11/07, gnv shqp [EMAIL PROTECTED] wrote:
 
  Hi R-experts,
 
  I have data from four conditions of an experiment.  I tried to create four
  subsets of the data with read.table, for example,
  read.table(Experiment.csv,subset=(condition==1))
  .  I found a similar post in the archive, but the answer to that post was
  no.   Any  new ideas about  reading subsets of data with read.table?
 
  Thanks!
 
  Feng
 
 [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 



 --
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem you are trying to solve?

 [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 
WenSui Liu
A lousy statistician who happens to know a little programming
(http://spaces.msn.com/statcompute/blog)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table for a subset of data

2007-03-11 Thread jim holtman
If you know what 10 rows to read, then you can 'skip' to them, but it the
system still has to read each line at a time.

I have a 200,000 line csv file of numerics that takes me 4 seconds to read
in with 'read.csv' using 'colClasses', so I would guess your 100K line file
would take half of that.  Is 2 seconds of time a waste of resources?


On 3/11/07, Wensui Liu [EMAIL PROTECTED] wrote:

 Jim,

 Glad to see your reply.

 Refering to your email, what if I just want to read 10 rows from a csv
 table with 10 rows? Do you think it a waste of resource to read
 the whole table in?
 Anything thought?

 wensui

 On 3/11/07, jim holtman [EMAIL PROTECTED] wrote:
  Why cann't you read in the whole data set and then create the
 subsets?  This
  is easily done with 'split'.  If the data is too large, then consider a
 data
  base.
 
  On 3/11/07, gnv shqp [EMAIL PROTECTED] wrote:
  
   Hi R-experts,
  
   I have data from four conditions of an experiment.  I tried to create
 four
   subsets of the data with read.table, for example,
   read.table(Experiment.csv,subset=(condition==1))
   .  I found a similar post in the archive, but the answer to that post
 was
   no.   Any  new ideas about  reading subsets of data with read.table?
  
   Thanks!
  
   Feng
  
  [[alternative HTML version deleted]]
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
  
 
 
 
  --
  Jim Holtman
  Cincinnati, OH
  +1 513 646 9390
 
  What is the problem you are trying to solve?
 
  [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


 --
 WenSui Liu
 A lousy statistician who happens to know a little programming
 (http://spaces.msn.com/statcompute/blog)




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] read.table

2006-10-19 Thread Weiwei Shi
hi,

how could I let the colname be the numbers instead of X plus numbers
when I use read.table. Or there is an alternative way?

thanks

-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table

2006-10-19 Thread Marc Schwartz
On Thu, 2006-10-19 at 16:10 -0400, Weiwei Shi wrote:
 hi,
 
 how could I let the colname be the numbers instead of X plus numbers
 when I use read.table. Or there is an alternative way?
 
 thanks

Sounds like you have imported the data, perhaps using 'header = TRUE'
either without an actual header row of column names or perhaps an
incomplete or improper (not syntactically valid) header row. 

If you are getting X's (and not V's) pre-pended to the column names,
that sounds like the result of make.names() on your data. 

See ?make.names

If you don't have a header row in the imported data set, you can use the
'colnames' argument in read.table() to explicitly provide them. Just be
sure to set 'header = FALSE'.

If there is a header row, but it is problematic, set 'header = FALSE'
AND 'skip = 1', which will skip over the first row in the incoming file.

See ?read.table

HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table

2006-10-19 Thread Weiwei Shi
thanks. i know how to go around it but i feel read.table should have
something like that to disable the process of adding X to the header
:)

On 10/19/06, Marc Schwartz [EMAIL PROTECTED] wrote:
 On Thu, 2006-10-19 at 16:10 -0400, Weiwei Shi wrote:
  hi,
 
  how could I let the colname be the numbers instead of X plus numbers
  when I use read.table. Or there is an alternative way?
 
  thanks

 Sounds like you have imported the data, perhaps using 'header = TRUE'
 either without an actual header row of column names or perhaps an
 incomplete or improper (not syntactically valid) header row.

 If you are getting X's (and not V's) pre-pended to the column names,
 that sounds like the result of make.names() on your data.

 See ?make.names

 If you don't have a header row in the imported data set, you can use the
 'colnames' argument in read.table() to explicitly provide them. Just be
 sure to set 'header = FALSE'.

 If there is a header row, but it is problematic, set 'header = FALSE'
 AND 'skip = 1', which will skip over the first row in the incoming file.

 See ?read.table

 HTH,

 Marc Schwartz





-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table

2006-10-19 Thread Marc Schwartz
On Thu, 2006-10-19 at 17:06 -0400, Weiwei Shi wrote:
 thanks. i know how to go around it but i feel read.table should have
 something like that to disable the process of adding X to the header
 :)

You could try setting 'check.names = FALSE' to see what you end up with
in terms of column names. That will effectively disable the use of
make.names() to validate/adjust the incoming column names.

The risk here is unknown depending upon the root etiology of the
problem.

HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table() and scientific notation

2006-10-11 Thread mmiller3
 January == January Weiner [EMAIL PROTECTED] writes:

 Dear all, I am having troubles importing values written as
 scientific notation using read.table(). I'm sure this is a
 frequent problem, as many people in my lab have this
 problem as well, so I'm sure that I just have troubles
 googling for the right solution.

 The problem is, that, given a file like that:

 a 1 2e-4
 b 2 3e-8
 ...

Note: this is advocacy for education in clear quantitative
language and is a border-line off topic rant...

The other day I read a paper from a student who used notation
like 2e-4 in the text - blech!  I sent it back for revisions.
Lately I have noticed here and in other places this tendency to
use floating point notation (also referred to as exponential
notation) where scientific notation is appropriate, and vice
versa.  The notation 2e-4 is a convenient way to express floating
point numbers with a simple text string, but it is certainly not
scientific notation.  No wonder you had trouble googling it!

Mike

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table() and scientific notation

2006-10-11 Thread January Weiner
 Note: this is advocacy for education in clear quantitative
 language and is a border-line off topic rant...

 The other day I read a paper from a student who used notation
 like 2e-4 in the text - blech!  I sent it back for revisions.

You have sent it back for revisions just because the student used a
version of the scientific notation that can be routinely found in
literature? Hm. I am _teaching_ my students to understand the
scientific notation in the form 1e-20 etc. - for example, because
many programs in the field (including R) are representing real numbers
using this version of scientific notation. I wouldn't penalize a
student for using it in a scientific text. That's what the proof
reading is for (if the editors are picky).

 Lately I have noticed here and in other places this tendency to
 use floating point notation (also referred to as exponential
 notation) where scientific notation is appropriate, and vice
 versa.  The notation 2e-4 is a convenient way to express floating
 point numbers with a simple text string, but it is certainly not
 scientific notation.

Depends how formal and picky you wish to be. 2e-4 is the same as
$2\times10^{-4}$ to me as it is for most people, I guess (e.g. look at
the Wikipedia entry).

 No wonder you had trouble googling it!

Nope. The problem with googling is that most of the pages you get when
googling for R do not refer to R as the statistical language.

Cheers,

January


-- 
 January Weiner 3  -+---
Division of Bioinformatics, University of Muenster  |  Schloßplatz 4
(+49)(251)8321634   |  D48149 Münster
http://www.uni-muenster.de/Evolution/ebb/   |  Germany

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] read.table() and scientific notation

2006-10-10 Thread January Weiner
Dear all,

I am having troubles importing values written as scientific notation
using read.table(). I'm sure this is a frequent problem, as many
people in my lab have this problem as well, so I'm sure that I just
have troubles googling for the right solution.

The problem is, that, given a file like that:

a 1 2e-4
b 2 3e-8
...

the third column gets imported as a factor, or a string if I set the
as.is parameter of read.table to TRUE for this column. However, I just
want a simple numeric vector :-) I'm sure there is a simple trick for
this. If you can point me to the right function, or manual, I think I
should be able to find out the details myself.

Thanks in advance,
January

-- 
 January Weiner 3  -+---
Division of Bioinformatics, University of Muenster  |  Schloßplatz 4
(+49)(251)8321634   |  D48149 Münster
http://www.uni-muenster.de/Biologie.Botanik/ebb/|  Germany

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table() and scientific notation

2006-10-10 Thread Gabor Grothendieck
Your example does not exhibit that behavior when I try it (below).
Can you provide a reproducible example following the style
shown here:

 Lines - a 1 2e-4
+ b 2 3e-8

 DF - read.table(textConnection(Lines))
 str(DF)
'data.frame':   2 obs. of  3 variables:
 $ V1: Factor w/ 2 levels a,b: 1 2
 $ V2: int  1 2
 $ V3: num  2e-04 3e-08
 R.version.string # Windows XP
[1] R version 2.4.0 (2006-10-03)


On 10/10/06, January Weiner [EMAIL PROTECTED] wrote:
 Dear all,

 I am having troubles importing values written as scientific notation
 using read.table(). I'm sure this is a frequent problem, as many
 people in my lab have this problem as well, so I'm sure that I just
 have troubles googling for the right solution.

 The problem is, that, given a file like that:

 a 1 2e-4
 b 2 3e-8
 ...

 the third column gets imported as a factor, or a string if I set the
 as.is parameter of read.table to TRUE for this column. However, I just
 want a simple numeric vector :-) I'm sure there is a simple trick for
 this. If you can point me to the right function, or manual, I think I
 should be able to find out the details myself.

 Thanks in advance,
 January

 --
  January Weiner 3  -+---
 Division of Bioinformatics, University of Muenster  |  Schloßplatz 4
 (+49)(251)8321634   |  D48149 Münster
 http://www.uni-muenster.de/Biologie.Botanik/ebb/|  Germany

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table() and scientific notation

2006-10-10 Thread Prof Brian Ripley
On FC5 Linux:

gannet% cat  foo.dat
a 1 2e-4
b 2 3e-8
gannet% R
...
 read.table(foo.dat)
   V1 V2V3
1  a  1 2e-04
2  b  2 3e-08
 sapply(read.table(foo.dat), class)
V1V2V3
  factor integer numeric

so please tell us your environment and give a reproducible example.  (This 
is using the OS function strtod, so it might be a deficiency in your OS's 
implementation of ISO C.)

On Tue, 10 Oct 2006, January Weiner wrote:

 Dear all,

 I am having troubles importing values written as scientific notation
 using read.table(). I'm sure this is a frequent problem, as many
 people in my lab have this problem as well, so I'm sure that I just
 have troubles googling for the right solution.

 The problem is, that, given a file like that:

 a 1 2e-4
 b 2 3e-8
 ...

 the third column gets imported as a factor, or a string if I set the
 as.is parameter of read.table to TRUE for this column. However, I just
 want a simple numeric vector :-) I'm sure there is a simple trick for
 this. If you can point me to the right function, or manual, I think I
 should be able to find out the details myself.

 Thanks in advance,
 January



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table() and scientific notation

2006-10-10 Thread January Weiner
Oh, thanks, that was hint enough :-) I see it now. I turns that R does
not understand

e-10

...which stands for 1e-10 and is produced by some of the bioinformatic
applications that I use (notably BLAST). However, R instead of being
verbose on that just assumes that the whole column is a string.

Is there a way to enforce a specific conversion in R (for example, to
be able to see where the errors are?).

January

-- 
 January Weiner 3  -+---
Division of Bioinformatics, University of Muenster  |  Schloßplatz 4
(+49)(251)8321634   |  D48149 Münster
http://www.uni-muenster.de/Biologie.Botanik/ebb/|  Germany

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table() and scientific notation

2006-10-10 Thread Martin C. Martin
I think the colClasses argument to read.table() is what you need. 
Either that, or explicitly cast columns in the data.frame that's 
returned by read.table().  That's how you get data types that aren't 
directly supported by read.table(), like various date formats.

- Martin

January Weiner wrote:
 Oh, thanks, that was hint enough :-) I see it now. I turns that R does
 not understand
 
 e-10
 
 ...which stands for 1e-10 and is produced by some of the bioinformatic
 applications that I use (notably BLAST). However, R instead of being
 verbose on that just assumes that the whole column is a string.
 
 Is there a way to enforce a specific conversion in R (for example, to
 be able to see where the errors are?).
 
 January


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table() and scientific notation

2006-10-10 Thread Prof Brian Ripley
On Tue, 10 Oct 2006, January Weiner wrote:

 Oh, thanks, that was hint enough :-) I see it now. I turns that R does
 not understand

 e-10

 ...which stands for 1e-10 and is produced by some of the bioinformatic
 applications that I use (notably BLAST).

And that is not standard C notation.

 However, R instead of being
 verbose on that just assumes that the whole column is a string.

 Is there a way to enforce a specific conversion in R (for example, to
 be able to see where the errors are?).

Please study ?read.table, especially 'colClasses'.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.table() and scientific notation

2006-10-10 Thread Alex Brown
A cheeky solution by subverting the coerce mechanism and read.table:

# install a coerce function which can fix the e+10 syntax for an  
imaginary class myDouble:

  setAs(character, myDouble, function(from)as.double(sub('^(-?) 
e','\\11e',from)))
Warning message:
in the method signature for function 'coerce' no definition for  
class: “myDouble” in: matchSignature(signature, fdef, where)

# load some data:

  Lines - scan(sep=\n, what=)
a 1 3e-8
b 2 1e+10
c 3 e-10
d 4 e+3
e 5 e+1

# process it without using the imaginary class - use a real double  
instead to see what happens:
# Note I've used textConnection(Lines) here, where your filename  
would go

  T - read.table(textConnection(Lines), colClasses=list 
(character, integer, double))
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,  
na.strings,  :
scan() expected 'a real', got 'e-10'

# process it, specifying the imaginary class myDouble.

  T - read.table(textConnection(Lines), colClasses=list 
(character, integer, myDouble))
  T
   V1 V2V3
1  a  1 3e-08
2  b  2 1e+10
3  c  3 1e-10
4  d  4 1e+03
5  e  5 1e+01

  lapply(T, class)
$V1
[1] character

$V2
[1] integer

$V3
[1] numeric


Someone's bound to shoot me down for hackery here :-)

-Alex

On 10 Oct 2006, at 11:43, January Weiner wrote:

 Dear all,

 I am having troubles importing values written as scientific notation
 using read.table(). I'm sure this is a frequent problem, as many
 people in my lab have this problem as well, so I'm sure that I just
 have troubles googling for the right solution.

 The problem is, that, given a file like that:

 a 1 2e-4
 b 2 3e-8
 ...

 the third column gets imported as a factor, or a string if I set the
 as.is parameter of read.table to TRUE for this column. However, I just
 want a simple numeric vector :-) I'm sure there is a simple trick for
 this. If you can point me to the right function, or manual, I think I
 should be able to find out the details myself.

 Thanks in advance,
 January

 -- 
  January Weiner 3  -+---
 Division of Bioinformatics, University of Muenster  |  Schloßplatz 4
 (+49)(251)8321634   |  D48149 Münster
 http://www.uni-muenster.de/Biologie.Botanik/ebb/|  Germany

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] read.table() features {was difficult data ..}

2006-07-04 Thread Martin Maechler
 Gabor == Gabor Grothendieck [EMAIL PROTECTED]
 on Mon, 3 Jul 2006 16:58:14 -0400 writes:

Gabor Try this:

Gabor # test data
Gabor # read in header separately so R does not make column names unique

Gabor Lines - AAA BBB CCC DDD AAA BBB
Gabor 0  2  1 2  0  0
Gabor 2  3  7 6  0  1
Gabor 1.54  9 9  6  0
Gabor 1.06  1011 3  3
Gabor 
Gabor DF - read.table(textConnection(Lines), skip = 1)
Gabor names(DF) - scan(textConnection(Lines), what = , nlines = 1)

Hmm, this is unnecessarily slightly complicated.
Instead, rather make use of read.table()'s capabilities, by

   DF - read.table(textConnection(Lines), check.names=FALSE, header=TRUE)
   ##  ^

Martin Maechler, ETH Zurich

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table with data in specific formats

2006-05-18 Thread YIHSU CHEN
Dear R Users

 Does anyone know how to read a text with a specific format?   I know that has 
to do with two functions: read.table and sprintf but not sure how to put them 
together.   Say that I have a text file called data.txt, and I would to read 
it according with  %.14f %.10f %2.5f, which includes three columns.

Thank you very much.


Yihsu Chen
The Johns Hopkins University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table with data in specific formats

2006-05-18 Thread Xiao Liu
read.table segments rows by separators, not by format of entry.

Suppose your data.txt is like:
1.00 2.01 3.003
4.10 5.22 6.333
7.22 8.88 9.99

Then
 read.table(data.txt, sep =  )

Best Regards
XiaoQuoting YIHSU CHEN [EMAIL PROTECTED]:

 Dear R Users

  Does anyone know how to read a text with a specific format?   I know
 that has to do with two functions: read.table and sprintf but not sure
 how to put them together.   Say that I have a text file called
 data.txt, and I would to read it according with  %.14f %.10f %2.5f,
 which includes three columns.

 Thank you very much.


 Yihsu Chen
 The Johns Hopkins University

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html



***
Xiao Liu
Stanford University Medical Center
Department of Developmental Biology
279 Campus Drive
Stanford, CA 94305-5329
(650)725-7612(L)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table (Error in file(file, r) : unable to open connection)

2006-05-08 Thread David.Lowery
G’day,

I am trying to read in a table and am getting an error message stating that R 
is unable to open a connection to the file.  

➢ Avonvegen- read.table(Y:\Study 
Sites\Avon\nonspatial\datafiles\archive\Avon_VegEnh.dat , sep=,, 
na.string=-, header=TRUE)
Error in file(file, r) : unable to open connection
In addition: Warning message:
cannot open file 'Y:Study SitesAvon
onspatialdatafilesrchiveAvon_VegEnh.dat ', reason 'Invalid argument'


I have checked that the AvonVegEnh.dat is spelt correctly and has no hidden 
extensions.
I have checked that the folder is accessible.
I have moved the datafile and changed the script to try reading from the local 
drive with no success.

I have used the same syntax on a similar file (same field structure but 
different data) with no problems before and now it doesn't read either.  

Does anyone have any ideas?

Thanks, 
david

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] read.table (Error in file(file, r) : unable to open connection)

2006-05-08 Thread Gabor Grothendieck
See 2.16 of the R Windows FAQ.

On 5/8/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 G'day,

 I am trying to read in a table and am getting an error message stating that R 
 is unable to open a connection to the file.

 ➢ Avonvegen- read.table(Y:\Study 
 Sites\Avon\nonspatial\datafiles\archive\Avon_VegEnh.dat , sep=,, 
 na.string=-, header=TRUE)
 Error in file(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file 'Y:Study SitesAvon
 onspatialdatafilesrchiveAvon_VegEnh.dat ', reason 'Invalid argument'
 

 I have checked that the AvonVegEnh.dat is spelt correctly and has no hidden 
 extensions.
 I have checked that the folder is accessible.
 I have moved the datafile and changed the script to try reading from the 
 local drive with no success.

 I have used the same syntax on a similar file (same field structure but 
 different data) with no problems before and now it doesn't read either.

 Does anyone have any ideas?

 Thanks,
 david

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] read.table (Error in file(file, r) : unable to open connection)

2006-05-08 Thread ronggui
I guess you use R under windows,then use \\ instead of \.

or use file.choose() to choose the file directly.


2006/5/9, [EMAIL PROTECTED] [EMAIL PROTECTED]:
 G'day,

 I am trying to read in a table and am getting an error message stating that R 
 is unable to open a connection to the file.

 ➢ Avonvegen- read.table(Y:\Study 
 Sites\Avon\nonspatial\datafiles\archive\Avon_VegEnh.dat , sep=,, 
 na.string=-, header=TRUE)
 Error in file(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file 'Y:Study SitesAvon
 onspatialdatafilesrchiveAvon_VegEnh.dat ', reason 'Invalid argument'
 

 I have checked that the AvonVegEnh.dat is spelt correctly and has no hidden 
 extensions.
 I have checked that the folder is accessible.
 I have moved the datafile and changed the script to try reading from the 
 local drive with no success.

 I have used the same syntax on a similar file (same field structure but 
 different data) with no problems before and now it doesn't read either.

 Does anyone have any ideas?

 Thanks,
 david

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


--
黄荣贵
Deparment of Sociology
Fudan University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] Read.table

2006-03-08 Thread Matias Mayor Fernandez
Hi,

 

I have some column vector in txt or xls and I need to load into R as numeric
vector.

 

I use the read.table  (X=read.table(123.txt”) command but the program say
that “X is not a numeric vector”

 

 

Where is the problem?

 

Matías

 

University of Oviedo,

 

Spain


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Read.table

2006-03-08 Thread Uwe Ligges
Matias Mayor Fernandez wrote:

 Hi,
 
  
 
 I have some column vector in txt or xls and I need to load into R as numeric
 vector.
 
  
 
 I use the read.table  (X=read.table(123.txt”) command but the program say
 that “X is not a numeric vector”

No, I think you got:

   Error: syntax error in (X=read.table(123.txt

or you have used another call without the syntax error in it.

In any case, please be more specific what you did. You might also want 
to copy the first few lines of file 123.txt in your mail.

Uwe Ligges


  
 
  
 
 Where is the problem?
 
  
 
 Matías
 
  
 
 University of Oviedo,
 
  
 
 Spain
 
 
   [[alternative HTML version deleted]]
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Read.table

2006-03-08 Thread Liaw, Andy
From: Uwe Ligges
 
 Matias Mayor Fernandez wrote:
 
  Hi,
  
   
  
  I have some column vector in txt or xls and I need to load 
 into R as 
  numeric vector.
  
   
  
  I use the read.table  (X=read.table(123.txt) command but 
 the program 
  say that X is not a numeric vector
 
 No, I think you got:
 
Error: syntax error in (X=read.table(123.txt
 
 or you have used another call without the syntax error in it.
 
 In any case, please be more specific what you did. You might 
 also want 
 to copy the first few lines of file 123.txt in your mail.

Besides, if Matias only has one column of data and want that read in as a
vector, scan() is really more appropriate.

Andy

 
 Uwe Ligges
 
 
   
  
   
  
  Where is the problem?
  
   
  
  Matías
  
   
  
  University of Oviedo,
  
   
  
  Spain
  
  
  [[alternative HTML version deleted]]
  
  
  
  
 --
  --
  
  __
  R-help@stat.math.ethz.ch mailing list 
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 __
 R-help@stat.math.ethz.ch mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Read.table

2006-03-08 Thread Sean Davis



On 3/8/06 8:31 AM, Liaw, Andy [EMAIL PROTECTED] wrote:

 From: Uwe Ligges
 
 Matias Mayor Fernandez wrote:
 
 Hi,
 
  
 
 I have some column vector in txt or xls and I need to load
 into R as 
 numeric vector.
 
  
 
 I use the read.table  (X=read.table(123.txt) command but
 the program 
 say that X is not a numeric vector

See here if you want to think of your data as a single-column table:

http://cran.r-project.org/doc/manuals/R-data.html#Spreadsheet_002dlike-data

Sean

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table missing values

2006-02-22 Thread I.Szentirmai
Dear R users,

I'm trying to read data from a tab-delimited text file to 
R, but I have problems with missing values. R gives this 
kind of error messages: line 1 did not have 9 elements.

Could someone tell me how I can deal with missing values 
in this case?

Thanks a lot in advance,
Istvan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table missing values

2006-02-22 Thread Sean Davis
Does using read.delim instead of read.table fix your problem?

Sean


On 2/22/06 7:40 AM, I.Szentirmai [EMAIL PROTECTED] wrote:

 Dear R users,
 
 I'm trying to read data from a tab-delimited text file to
 R, but I have problems with missing values. R gives this
 kind of error messages: line 1 did not have 9 elements.
 
 Could someone tell me how I can deal with missing values
 in this case?
 
 Thanks a lot in advance,
 Istvan
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table missing values

2006-02-22 Thread I.Szentirmai
might be, but I have already found another solution: 
reat.table(file,sep=\t)

Thanks,
Istvan



On Wed, 22 Feb 2006 07:54:49 -0500
  Sean Davis [EMAIL PROTECTED] wrote:
 Does using read.delim instead of read.table fix your 
problem?
 
 Sean
 
 
 On 2/22/06 7:40 AM, I.Szentirmai [EMAIL PROTECTED] 
wrote:
 
 Dear R users,
 
 I'm trying to read data from a tab-delimited text file 
to
 R, but I have problems with missing values. R gives this
 kind of error messages: line 1 did not have 9 
elements.
 
 Could someone tell me how I can deal with missing values
 in this case?
 
 Thanks a lot in advance,
 Istvan
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table missing values

2006-02-22 Thread MMcIntosh
I have experienced a similar problem when saving Excel data in this
format.  When any of the variables, except the last, contained missing
values, there was not a problem.  However, the problem occurred when the
last variable contained missing values.  My guess is that the last
delimiter was left off?  The fill option worked in my case.  Use the
option with care and double check the dataset.

HTH
Matthew McIntosh



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of I.Szentirmai
Sent: Wednesday, February 22, 2006 7:04 AM
To: r-help
Subject: Re: [R] read.table missing values

might be, but I have already found another solution: 
reat.table(file,sep=\t)

Thanks,
Istvan



On Wed, 22 Feb 2006 07:54:49 -0500
  Sean Davis [EMAIL PROTECTED] wrote:
 Does using read.delim instead of read.table fix your 
problem?
 
 Sean
 
 
 On 2/22/06 7:40 AM, I.Szentirmai [EMAIL PROTECTED] 
wrote:
 
 Dear R users,
 
 I'm trying to read data from a tab-delimited text file 
to
 R, but I have problems with missing values. R gives this
 kind of error messages: line 1 did not have 9 
elements.
 
 Could someone tell me how I can deal with missing values
 in this case?
 
 Thanks a lot in advance,
 Istvan
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2006-02-14 Thread Kjetil Brinchmann Halvorsen
Diethelm Wuertz wrote:
 Thanks a lot that works fine!
 
 Next problem, if I would have my own package, and the file test.csv
 would be located in the data directory
 
 How to use the function data to get
 
   data(test)

Also put in the data subdirectory the file test.R
with the commands to read  test.csv

Kjetil

 
 resulting in:
 
   test
 
 %y-%m-%d VALUE
 1 1999-01-01   100
 2 2000-12-31   999
 
 
 Again Thanks in advance Diethelm Wuertz
 
 
 
 
 Phil Spector wrote:
 
 Look at the check.names= argument to read.table -- you want to set it
 to FALSE.  But rememeber that you'l have to put quotes around the name
 whenever you use it, as in x$'%y-%m-%d'

- Phil Spector
  Statistical Computing Facility
  Department of Statistics
  UC Berkeley
  [EMAIL PROTECTED]

 On Tue, 14 Feb 2006, Diethelm Wuertz wrote:


 I have a file named test.csv with the following 3 lines:

 %y-%m-%d;VALUE
 1999-01-01;100
 2000-12-31;999


 read.table(test.csv, header = TRUE, sep = ;)
 delivers:

   X.y..m..d VALUE
 1 1999-01-01   100
 2 2000-12-31   999


 I would like to see the following ...

%y-%m-%d VALUE
 1 1999-01-01   100
 2 2000-12-31   999


 Note,

 readLines(test.csv, 1)
 delivers

 [1] %y-%m-%d;VALUE


 Is this possible ???


 Thanks DW

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table

2006-02-14 Thread Max Kauer
Hi
it appears to me that read.table is very slow for reading large data files
(mine are 200,000 rows). Is there a better way?
Thanks!
Max

-- 
Maximilian O. Kauer, Ph.D.
Department of Genetics, White lab
333 Cedar St, NSB 386
PO Box 208005
New Haven, CT 06510

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2006-02-14 Thread roger bos
?scan is much faser.  Also, read.table has a colClasses optional argument
which can be used to speed up the reading of large files significantly.
read.table has a pretty good help section well worth reading.

 read.table(file, header = FALSE, sep = , quote = \', dec = .,
row.names, col.names, as.is = FALSE, na.strings = NA,
colClasses = NA, nrows = -1,
skip = 0, check.names = TRUE, fill = !blank.lines.skip,
strip.white = FALSE, blank.lines.skip = TRUE,
comment.char = #, allowEscapes = FALSE)


2006/2/14, Max Kauer [EMAIL PROTECTED]:

 Hi
 it appears to me that read.table is very slow for reading large data files
 (mine are 200,000 rows). Is there a better way?
 Thanks!
 Max

 --
 Maximilian O. Kauer, Ph.D.
 Department of Genetics, White lab
 333 Cedar St, NSB 386
 PO Box 208005
 New Haven, CT 06510

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table

2006-02-13 Thread Diethelm Wuertz


I have a file named test.csv with the following 3 lines:

%y-%m-%d;VALUE
1999-01-01;100
2000-12-31;999


  read.table(test.csv, header = TRUE, sep = ;)

delivers:

   X.y..m..d VALUE
1 1999-01-01   100
2 2000-12-31   999


I would like to see the following ...

%y-%m-%d VALUE
1 1999-01-01   100
2 2000-12-31   999


Note,

  readLines(test.csv, 1)

delivers

[1] %y-%m-%d;VALUE


Is this possible ???


Thanks DW

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2006-02-13 Thread jim holtman
?read.table

The documentation has the parameter 'check.names'.


On 2/13/06, Diethelm Wuertz [EMAIL PROTECTED] wrote:



 I have a file named test.csv with the following 3 lines:

 %y-%m-%d;VALUE
 1999-01-01;100
 2000-12-31;999


  read.table(test.csv, header = TRUE, sep = ;)

 delivers:

   X.y..m..d VALUE
 1 1999-01-01   100
 2 2000-12-31   999


 I would like to see the following ...

%y-%m-%d VALUE
 1 1999-01-01   100
 2 2000-12-31   999


 Note,

  readLines(test.csv, 1)

 delivers

 [1] %y-%m-%d;VALUE


 Is this possible ???


 Thanks DW

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html




--
Jim Holtman
Cincinnati, OH
+1 513 247 0281

What the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2006-02-13 Thread Gabor Grothendieck
You can do it manually by reading in the headers separately:

headers - read.table(test, header = FALSE, nrow = 1, sep = ;, as.is = TRUE)
read.table(test, header = FALSE, skip = 1, sep = ;, col.names = headers)

On 2/13/06, Diethelm Wuertz [EMAIL PROTECTED] wrote:


 I have a file named test.csv with the following 3 lines:

 %y-%m-%d;VALUE
 1999-01-01;100
 2000-12-31;999


   read.table(test.csv, header = TRUE, sep = ;)

 delivers:

   X.y..m..d VALUE
 1 1999-01-01   100
 2 2000-12-31   999


 I would like to see the following ...

%y-%m-%d VALUE
 1 1999-01-01   100
 2 2000-12-31   999


 Note,

   readLines(test.csv, 1)

 delivers

 [1] %y-%m-%d;VALUE


 Is this possible ???


 Thanks DW

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2006-02-13 Thread Diethelm Wuertz
Thanks a lot that works fine!

Next problem, if I would have my own package, and the file test.csv
would be located in the data directory

How to use the function data to get

  data(test)

resulting in:

  test

%y-%m-%d VALUE
1 1999-01-01   100
2 2000-12-31   999


Again Thanks in advance Diethelm Wuertz




Phil Spector wrote:

 Look at the check.names= argument to read.table -- you want to set it
 to FALSE.  But rememeber that you'l have to put quotes around the name
 whenever you use it, as in x$'%y-%m-%d'

- Phil Spector
  Statistical Computing Facility
  Department of Statistics
  UC Berkeley
  [EMAIL PROTECTED]

 On Tue, 14 Feb 2006, Diethelm Wuertz wrote:



 I have a file named test.csv with the following 3 lines:

 %y-%m-%d;VALUE
 1999-01-01;100
 2000-12-31;999


  read.table(test.csv, header = TRUE, sep = ;)

 delivers:

   X.y..m..d VALUE
 1 1999-01-01   100
 2 2000-12-31   999


 I would like to see the following ...

%y-%m-%d VALUE
 1 1999-01-01   100
 2 2000-12-31   999


 Note,

  readLines(test.csv, 1)

 delivers

 [1] %y-%m-%d;VALUE


 Is this possible ???


 Thanks DW

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2006-02-13 Thread David Scott
On Tue, 14 Feb 2006, Diethelm Wuertz wrote:

 Thanks a lot that works fine!

 Next problem, if I would have my own package, and the file test.csv
 would be located in the data directory

 How to use the function data to get

  data(test)

 resulting in:

  test

%y-%m-%d VALUE
 1 1999-01-01   100
 2 2000-12-31   999



I think you might be stuck in a particular mindset about this.

Does the .csv file have to be called test.csv?

If not then if it is called data.csv say, you can have in your data 
directory a file test.R with the code:

read.table(data.csv, header = TRUE, sep = ;, check.names = FALSE)

Alternatively you can have the data in the file test.R, plus the code to 
read it in as desired. Creating a data structure and reading it back in 
with dput and dget is one way to do this.

See page 11 of the Writing R Extensions manual for the possible formats of 
files in the data directory:

The data subdirectory is for additional data files the package makes 
available for loading using data(). Currently, data files can have one of 
three types as indicated by their extension: plain R code (.R or .r), 
tables (.tab, .txt, or .csv), or save() images (.RData or .rda). (All 
ports of R use the same binary (XDR) format and can read compressed 
images. Use images saved with save(, compress = TRUE) to save space.) Note 
that R code should be self-sufficient and not make use of extra 
functionality provided by the package, so that the data file can also be 
used without having to load the package.

David Scott



_
David Scott Department of Statistics, Tamaki Campus
The University of Auckland, PB 92019
AucklandNEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED]


Graduate Officer, Department of Statistics

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table problem

2006-01-25 Thread Andrej Kastrin
Dear R useRs,

I have big (23000 rows), vertical bar delimited file:

e.g.
A1|Text a,Text b, Text c|345
A2|Text bla|456
...
..
.

Try using

A - read.table('filename.txt', header=FALSE,sep='\|')
 
process stop at line 11975 with warning message:
number of items read is not a multiple of the number of columns

I have no problems with processing similar file, which is only 1 
rows long?

Any suggestion what's the problem here. Thank's in advance.

Cheers, Andrej

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table problem

2006-01-25 Thread Peter Dalgaard
Andrej Kastrin [EMAIL PROTECTED] writes:

 Dear R useRs,
 
 I have big (23000 rows), vertical bar delimited file:
 
 e.g.
 A1|Text a,Text b, Text c|345
 A2|Text bla|456
 ...
 ..
 .
 
 Try using
 
 A - read.table('filename.txt', header=FALSE,sep='\|')
  
 process stop at line 11975 with warning message:
 number of items read is not a multiple of the number of columns
 
 I have no problems with processing similar file, which is only 1 
 rows long?
 
 Any suggestion what's the problem here. Thank's in advance.

Well, the most obvious suspect is the file...

You might try 

table(count.fields('filename.txt',sep='|'))

(There's no point in escaping the vertical bar) 

Also, beware of quote symbols in the file, and possibly consider using
fill=TRUE.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table problem

2006-01-25 Thread Philippe Grosjean
Hello,
Well... the error message is explicit enough: number of items read is 
not a multiple of the number of columns means that you do not have the 
right number of items around line 11975 (not the same number as in the 
11974 previous lines)! This is an error in you file.
Best,

Philippe Grosjean

Andrej Kastrin wrote:
 Dear R useRs,
 
 I have big (23000 rows), vertical bar delimited file:
 
 e.g.
 A1|Text a,Text b, Text c|345
 A2|Text bla|456
 ...
 ..
 .
 
 Try using
 
 A - read.table('filename.txt', header=FALSE,sep='\|')
  
 process stop at line 11975 with warning message:
 number of items read is not a multiple of the number of columns
 
 I have no problems with processing similar file, which is only 1 
 rows long?
 
 Any suggestion what's the problem here. Thank's in advance.
 
 Cheers, Andrej
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table problem

2006-01-25 Thread bogdan romocea
By the way, you might find this sed one-liner useful:
   sed -n '11981q;11970,11980p' filename.txt
It will print the offending line and its neighbors. If you're on
Windows you need to install Windows Services For Unix or Cygwin.


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Andrej Kastrin
 Sent: Wednesday, January 25, 2006 3:08 AM
 To: r-help
 Subject: [R] read.table problem

 Dear R useRs,

 I have big (23000 rows), vertical bar delimited file:

 e.g.
 A1|Text a,Text b, Text c|345
 A2|Text bla|456
 ...
 ..
 .

 Try using

 A - read.table('filename.txt', header=FALSE,sep='\|')

 process stop at line 11975 with warning message:
 number of items read is not a multiple of the number of columns

 I have no problems with processing similar file, which is only 1
 rows long?

 Any suggestion what's the problem here. Thank's in advance.

 Cheers, Andrej

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table error

2005-12-07 Thread Eric C. Jennings
Hey, Once again I ask for some quick help.

Here is some code:
ovendata- read.table(ovens.dat,header=TRUE)
attach(ovendata)
print(ovendata)

Here is the .dat file:
DOne Two Three   FourFiveSeven   Eight
1130254 252 375 384 252 375 876
127 250 250 384 386 251 378 875

Here is the R Console output:
 ovendata- read.table(ovens.dat,header=TRUE)
Warning message:
incomplete final line found by readTableHeader on 'ovens.dat' 
 attach(ovendata)

The following object(s) are masked from ovendata ( position 3 ) :

 D Eight Five Four One Seven Three Two 


The following object(s) are masked from ovendata ( position 4 ) :

 D Eight Five Four One Seven Three Two 


The following object(s) are masked from ovendata ( position 5 ) :

 Eight Five Four One Seven Three Two 


The following object(s) are masked from package:stats :

 D 

 print(ovendata)
 D One Two Three Four Five Seven Eight
1 1130 254 252   375  384  252   375   876
2  127 250 250   384  386  251   378   875
 

I've never seen anything like theis before. What's going on?

Eric

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table without sep

2005-11-25 Thread Vasundhara Akkineni
Hello all,

I have a data file table.txt  which i have attached. I am trying to pass the
columns as arguments to a function totnorm where i am displaying a total
normalization plot. The function is given below:

totnorm-function(x,y){scale-sum(x)/sum(y);xlab-colnames(x);ylab-colnames(y);x1-x[[1]];y1-scale*y[[1]];plot(x1,y1,xlab=xlab,ylab=ylab,col=6,
col.lab=4);}

i tried doing this:

data-read.table(alldata.txt,header=TRUE,sep=\t)
a-data[1]
b-data[2]
totnorm(a,b)

The problem i am facing is- xlab and ylab contain the column names of
data[1] and data[2], but data[1][[1]] which is assigned to x1 has different
data which does not correspond to the colname(data[1]). Stating more
clearly, the colnames and the coldata don't match. I tried usind
read.tablewithout sep attribute, as given below:

data1-read.table(alldata.txt,header=TRUE)

But this statement is not getting executed using Rserve when i make a
connection to R and try to execute it from a java servlet. I don't know why
it was doing so, so thought it would be better to fix this on R side, i.e,
try to use the sep attribue in read.table and still make the colnames and
coldata point to the same col#.

Please suggest a solution.
Thanks,
Vasu.
14A_U133A_StatPairs 14A_U133A_Detection 14B_U133A_Signal
88A_U133A_Signal88B_U133A_Signal183A_U133A_Signal   
183B_U133A_Signal
AFFX-BioB-5_at  403.0   409.3   611.5   569.2   536.6   580.2   
AFFX-BioB-M_at  757.3   574.4   826.7   595.3   755.2   956.0   
AFFX-BioB-3_at  284.4   327.3   421.6   336.6   391.3   412.6   
AFFX-BioC-5_at  2314.2  1685.3  2264.7  2204.1  2233.1  2458.4  
AFFX-BioC-3_at  1574.5  1273.0  1484.6  1321.2  1474.7  1774.1  
AFFX-BioDn-5_at 2333.7  1796.8  2464.5  2372.5  2095.9  2735.7  
AFFX-BioDn-3_at 13673.9 11463.9 13624.7 14513.9 12934.1 16293.1 
AFFX-CreX-5_at  17778.8 15248.8 19977.2 19613.4 18609.1 18988.2 
AFFX-CreX-3_at  31056.6 24869.9 30773.4 32918.6 34412.1 33954.6 
AFFX-DapX-5_at  36.369.892.052.057.364.9
AFFX-DapX-M_at  133.4   75.176.2108.9   74.0100.2   
AFFX-DapX-3_at  10.011.184.09.6 9.3 9.6 
AFFX-LysX-5_at  40.431.18.3 6.6 8.6 50.0
AFFX-LysX-M_at  12.816.565.267.813.739.1
AFFX-LysX-3_at  66.18.6 83.59.4 43.928.7
AFFX-PheX-5_at  14.817.69.7 14.715.219.3
AFFX-PheX-M_at  70.612.422.888.08.0 18.5
AFFX-PheX-3_at  33.297.431.631.7129.5   11.1
AFFX-ThrX-5_at  26.431.314.523.428.124.2
AFFX-ThrX-M_at  87.443.989.433.052.452.8
AFFX-ThrX-3_at  19.918.913.926.124.017.0
AFFX-TrpnX-5_at 32.613.526.511.460.318.4
AFFX-TrpnX-M_at 14.97.5 12.110.111.312.8
AFFX-TrpnX-3_at 17.34.3 7.0 26.02.3 8.6 









__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] read.table without sep

2005-11-25 Thread P Ehlers
Vasu,

You have a lot of problems here.

1. How was your file generated? Excel? You have trailing tabs on
all but row 1 which is why your read.table call with sep=\t
gives you columns that don't seem to agree with what you expect.
See the argument row.names in ?read.table.

2. It's never a good idea to use colnames that begin with a digit.

3. read.table creates a _data frame_ for which data[i] would be
a data frame; your function does not accept data frames as input.
You probably want data[,i].

4. One-line 158-character function definitions with no spaces
are not exactly easy to read.

5. It's not clear whether you want the first column to be rownames
or data. R can handle both, but you need to tell it what to do.

6. * Best not to send such questions to R-devel. They have
nothing to do with the development of R.

Peter

Vasundhara Akkineni wrote:

 Hello all,
 
 I have a data file table.txt  which i have attached. I am trying to pass the
 columns as arguments to a function totnorm where i am displaying a total
 normalization plot. The function is given below:
 
 totnorm-function(x,y){scale-sum(x)/sum(y);xlab-colnames(x);ylab-colnames(y);x1-x[[1]];y1-scale*y[[1]];plot(x1,y1,xlab=xlab,ylab=ylab,col=6,
 col.lab=4);}
 
 i tried doing this:
 
 data-read.table(alldata.txt,header=TRUE,sep=\t)
 a-data[1]
 b-data[2]
 totnorm(a,b)

 
 The problem i am facing is- xlab and ylab contain the column names of
 data[1] and data[2], but data[1][[1]] which is assigned to x1 has different
 data which does not correspond to the colname(data[1]). Stating more
 clearly, the colnames and the coldata don't match. I tried usind
 read.tablewithout sep attribute, as given below:
 
 data1-read.table(alldata.txt,header=TRUE)
 
 But this statement is not getting executed using Rserve when i make a
 connection to R and try to execute it from a java servlet. I don't know why
 it was doing so, so thought it would be better to fix this on R side, i.e,
 try to use the sep attribue in read.table and still make the colnames and
 coldata point to the same col#.
 
 Please suggest a solution.
 Thanks,
 Vasu.
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Peter Ehlers
Department of Mathematics and Statistics
University of Calgary, 2500 University Dr. NW   ph: 403-220-3936
Calgary, Alberta  T2N 1N4, CANADA  fax: 403-282-5150

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table error with R 2.2.0

2005-11-09 Thread Florence Combes
Dear all,

I just upgraded version of R to R 2.2.0, and I have a problem with a script
that did not happen with my previous version.
Here is the error :

-
 param-read.table(file=param.dat,sep =\t,header=TRUE,fill=TRUE,
na.strings=NA)
Erreur dans read.table.default(file = param.dat, sep = \t, header =
TRUE, :
5 arguments passed to 'readTableHead' which requires 6
-

whereas all was OK before. I cannot understand what's happening.

Has someone already encountered this ??
Any help greatly appreciated,

Thanks a lot,

Florence.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table error with R 2.2.0

2005-11-09 Thread Duncan Murdoch
On 11/9/2005 10:07 AM, Florence Combes wrote:
 Dear all,
 
 I just upgraded version of R to R 2.2.0, and I have a problem with a script
 that did not happen with my previous version.
 Here is the error :
 
 -
 param-read.table(file=param.dat,sep =\t,header=TRUE,fill=TRUE,
 na.strings=NA)
 Erreur dans read.table.default(file = param.dat, sep = \t, header =
 TRUE, :
 5 arguments passed to 'readTableHead' which requires 6
 -
 
 whereas all was OK before. I cannot understand what's happening.
 
 Has someone already encountered this ??
 Any help greatly appreciated,

There is no read.table.default in standard R 2.2.0, so it appears that 
you have installed a replacement for read.table, and it no longer works. 
   If you type

getAnywhere(read.table)$where

and

getAnywhere(read.table.default)$where

you are likely to see where those functions came from.  (I see

  getAnywhere(read.table)$where
[1] package:base   namespace:base

  getAnywhere(read.table.default)$where
character(0)

indicating that read.table comes from the base package, and 
read.table.default doesn't exist.

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table error with R 2.2.0

2005-11-09 Thread Florence Combes
Thanks a lot for your answer.
In fact I found the solution, it's seems strange to me so I put it here if
it could bu useful for other people ...

I have the same as you
 getAnywhere(read.table)$where
[1] package:base namespace:base
 getAnywhere(read.table.default)$where
character(0)

when I run it in a native R console, and the line :
param-read.table(file=param.dat,sep =\t,header=TRUE,fill=TRUE,
na.strings=NA)

works very well. (I didn't test this before).


BUT when I load the aroma package (which I need for what I want to do), then
I have :
 getAnywhere(read.table)$where
[1] package:aroma
[2] package:base
[3] registered S3 method for read from namespace base
[4] namespace:base
 getAnywhere(read.table.default)$where
[1] package:aroma registered S3 method for read

and the read.table didn't work.

So I reinstall the aroma package (even if I had the latest version) and it
works well now).

best regards,

Florence.






On 11/9/05, Duncan Murdoch [EMAIL PROTECTED] wrote:

 On 11/9/2005 10:07 AM, Florence Combes wrote:
  Dear all,
 
  I just upgraded version of R to R 2.2.0, and I have a problem with a
 script
  that did not happen with my previous version.
  Here is the error :
 
  -
  param-read.table(file=param.dat,sep =\t,header=TRUE,fill=TRUE,
  na.strings=NA)
  Erreur dans read.table.default(file = param.dat, sep = \t, header =
  TRUE, :
  5 arguments passed to 'readTableHead' which requires 6
  -
 
  whereas all was OK before. I cannot understand what's happening.
 
  Has someone already encountered this ??
  Any help greatly appreciated,

 There is no read.table.default in standard R 2.2.0, so it appears that
 you have installed a replacement for read.table, and it no longer works.
 If you type

 getAnywhere(read.table)$where

 and

 getAnywhere(read.table.default)$where

 you are likely to see where those functions came from. (I see

  getAnywhere(read.table)$where
 [1] package:base namespace:base

  getAnywhere(read.table.default)$where
 character(0)

 indicating that read.table comes from the base package, and
 read.table.default doesn't exist.

 Duncan Murdoch


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table error with R 2.2.0

2005-11-09 Thread Peter Dalgaard
Florence Combes [EMAIL PROTECTED] writes:

 Dear all,
 
 I just upgraded version of R to R 2.2.0, and I have a problem with a script
 that did not happen with my previous version.
 Here is the error :
 
 -
  param-read.table(file=param.dat,sep =\t,header=TRUE,fill=TRUE,
 na.strings=NA)
 Erreur dans read.table.default(file = param.dat, sep = \t, header =
 TRUE, :
 5 arguments passed to 'readTableHead' which requires 6
 -
 
 whereas all was OK before. I cannot understand what's happening.

read.table is not generic in 2.2.0 and it calls 

.Internal(readTableHead(file, nlines, comment.char,
blank.lines.skip, quote, sep))


So where did  read.table.default() come into play? Is it picking up a
version that you yourself have modified perhaps? Or are you using some
package which redefines read.table and needs to be updated for 2.2.0?

-p

 
 Has someone already encountered this ??
 Any help greatly appreciated,
 
 Thanks a lot,
 
 Florence.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table error with R 2.2.0

2005-11-09 Thread Henrik Bengtsson
Florence Combes wrote:

Thanks a lot for your answer.
In fact I found the solution, it's seems strange to me so I put it here if
it could bu useful for other people ...

I have the same as you
  

getAnywhere(read.table)$where


[1] package:base namespace:base
  

getAnywhere(read.table.default)$where


character(0)

when I run it in a native R console, and the line :
param-read.table(file=param.dat,sep =\t,header=TRUE,fill=TRUE,
na.strings=NA)

works very well. (I didn't test this before).


BUT when I load the aroma package (which I need for what I want to do), then
I have :
  

getAnywhere(read.table)$where


[1] package:aroma
[2] package:base
[3] registered S3 method for read from namespace base
[4] namespace:base
  

getAnywhere(read.table.default)$where


[1] package:aroma registered S3 method for read

and the read.table didn't work.

So I reinstall the aroma package (even if I had the latest version) and it
works well now).

best regards,

Florence.

  

Hi, author of aroma here.  This was fixed a few months ago.  From 
showHistory(aroma):
Version: 0.84 [2005-07-01]
...
o BUG FIX: GenePixData$read() would give Error in read.table.default(...
  ...): 5 arguments passed to 'readTableHead' which requires 6.

What I have done/did is that I created a read.table.QuantArrayData() 
function, rename base::read.table() to read.table.default() and made 
read.table() generic.  This should make things rather backward 
compatible.  When I looked at my source code history, the reason for 
this was:

# 2002-08-18
# o Since the 'Measurements' section in QuantArray files seems to contain
#   rows with tailing TAB's (that just should be ignored) read.table() fails
#   to read them. read.table() is making use of scan() and scan() has the
#   argument 'flush' which flushes such trailing cells, but it is not used
#   by read.table(). For this reason I created the static read.table()
#   method of QuantArrrayData which has the 'flush' argument.

I other words, I just added the argument 'flush=FALSE' to 
read.table[.QuantArrayData]() and passes 'flush=flush' to its internal 
calls to scan().  I'll send R-devel a note and see if it is possible to 
add this argument to the default read.table().  However, everything 
should work correctly as it is now.

Cheers

Henrik





On 11/9/05, Duncan Murdoch [EMAIL PROTECTED] wrote:
  

On 11/9/2005 10:07 AM, Florence Combes wrote:


Dear all,

I just upgraded version of R to R 2.2.0, and I have a problem with a
  

script


that did not happen with my previous version.
Here is the error :

-
  

param-read.table(file=param.dat,sep =\t,header=TRUE,fill=TRUE,


na.strings=NA)
Erreur dans read.table.default(file = param.dat, sep = \t, header =
TRUE, :
5 arguments passed to 'readTableHead' which requires 6
-

whereas all was OK before. I cannot understand what's happening.

Has someone already encountered this ??
Any help greatly appreciated,
  

There is no read.table.default in standard R 2.2.0, so it appears that
you have installed a replacement for read.table, and it no longer works.
If you type

getAnywhere(read.table)$where

and

getAnywhere(read.table.default)$where

you are likely to see where those functions came from. (I see



getAnywhere(read.table)$where
  

[1] package:base namespace:base



getAnywhere(read.table.default)$where
  

character(0)

indicating that read.table comes from the base package, and
read.table.default doesn't exist.

Duncan Murdoch




   [[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


  


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table

2005-07-13 Thread Weiwei Shi
Hi,
I have a question on read.table.

I have a dataset with 273,000 lines and 195 columns. I used the
read.table to load the data into R:
trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
I found it takes forever.

then I run 1/10 of the data (test) using read.table again. And this
time it finished quickly. So, there might be something wrong in my
data format causing that problem.

then, my question is, is there a way in R to track at which line,
something wrong occurs?

Thanks,

Weiwei


-- 
Weiwei Shi, Ph.D

Did you always know?
No, I did not. But I believed...
---Matrix III

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Weiwei Shi
add:
I used
trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529, ncol=195)

it is done. 
so it seems that I just have no patience to wait for half an hour :)

but i still have that question:
is there a way to track the process if it takes too long. Could we
stop in the middle to see at which line it hesitates to move on?

regards,

weiwei


On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
 Hi,
 I have a question on read.table.
 
 I have a dataset with 273,000 lines and 195 columns. I used the
 read.table to load the data into R:
 trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
 I found it takes forever.
 
 then I run 1/10 of the data (test) using read.table again. And this
 time it finished quickly. So, there might be something wrong in my
 data format causing that problem.
 
 then, my question is, is there a way in R to track at which line,
 something wrong occurs?
 
 Thanks,
 
 Weiwei
 
 
 --
 Weiwei Shi, Ph.D
 
 Did you always know?
 No, I did not. But I believed...
 ---Matrix III
 


-- 
Weiwei Shi, Ph.D

Did you always know?
No, I did not. But I believed...
---Matrix III

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Gabor Grothendieck
You could use the nlines= argument to scan to read in a 
portion at a time.


On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote: 
 
 add:
 I used
 trn-matrix(scan('train1.dat', sep='|', na.string='.'), nrow=273529, 
 ncol=195)
 
 it is done.
 so it seems that I just have no patience to wait for half an hour :)
 
 but i still have that question:
 is there a way to track the process if it takes too long. Could we
 stop in the middle to see at which line it hesitates to move on?
 
 regards,
 
 weiwei
 
 
 On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
  Hi,
  I have a question on read.table.
 
  I have a dataset with 273,000 lines and 195 columns. I used the
  read.table to load the data into R:
  trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
  I found it takes forever.
 
  then I run 1/10 of the data (test) using read.table again. And this
  time it finished quickly. So, there might be something wrong in my
  data format causing that problem.
 
  then, my question is, is there a way in R to track at which line,
  something wrong occurs?
 
  Thanks,
 
  Weiwei
 
 
  --
  Weiwei Shi, Ph.D
 
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
 
 
 
 --
 Weiwei Shi, Ph.D
 
 Did you always know?
 No, I did not. But I believed...
 ---Matrix III
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Gabor Grothendieck
[I had some email problems and am sending this again.  Sorry
if you get it twice.]

You could use the nlines= argument to scan to read in a 
portion at a time. 
 
 
 
 
 On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote: 
  add:
  I used
  trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529, 
  ncol=195)
  
  it is done.
  so it seems that I just have no patience to wait for half an hour :)
  
  but i still have that question:
  is there a way to track the process if it takes too long. Could we
  stop in the middle to see at which line it hesitates to move on? 
  
  regards,
  
  weiwei
  
  
  On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
   Hi,
   I have a question on read.table.
  
   I have a dataset with 273,000 lines and 195 columns. I used the 
   read.table to load the data into R:
   trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
   I found it takes forever.
  
   then I run 1/10 of the data (test) using read.table again. And this
   time it finished quickly. So, there might be something wrong in my
   data format causing that problem.
  
   then, my question is, is there a way in R to track at which line,
   something wrong occurs? 
  
   Thanks,
  
   Weiwei
  
  
   --
   Weiwei Shi, Ph.D
  
   Did you always know?
   No, I did not. But I believed...
   ---Matrix III 
  
  
  
  --
  Weiwei Shi, Ph.D
  
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
  
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Weiwei Shi
that sort of works for my purpose.

btw, is there a bettter way to get data.frame by passing around
matrix(). Since I could not find data.frame() with nrow or ncol
arguments. so i have to use matrix first and then as.data.frame to
convert it.

is there any other (better) way?

weiwei

On 7/13/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 
 You could use the nlines= argument to scan to read in a 
 portion at a time.
 
 
  
 On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote: 
  
  add:
  I used
  trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529,
 ncol=195)
  
  it is done.
  so it seems that I just have no patience to wait for half an hour :)
  
  but i still have that question:
  is there a way to track the process if it takes too long. Could we
  stop in the middle to see at which line it hesitates to move on? 
  
  regards,
  
  weiwei
  
  
  On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
   Hi,
   I have a question on read.table.
  
   I have a dataset with 273,000 lines and 195 columns. I used the 
   read.table to load the data into R:
   trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
   I found it takes forever.
  
   then I run 1/10 of the data (test) using read.table again. And this
   time it finished quickly. So, there might be something wrong in my
   data format causing that problem.
  
   then, my question is, is there a way in R to track at which line,
   something wrong occurs? 
  
   Thanks,
  
   Weiwei
  
  
   --
   Weiwei Shi, Ph.D
  
   Did you always know?
   No, I did not. But I believed...
   ---Matrix III 
  
  
  
  --
  Weiwei Shi, Ph.D
  
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
  
 
  


-- 
Weiwei Shi, Ph.D

Did you always know?
No, I did not. But I believed...
---Matrix III

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Gabor Grothendieck
Maybe you don't really need a data frame in the first place?
You were concerned with speed and matrices tend to 
have higher performance than data frames.

On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
 that sort of works for my purpose.
 
 btw, is there a bettter way to get data.frame by passing around
 matrix(). Since I could not find data.frame() with nrow or ncol
 arguments. so i have to use matrix first and then as.data.frame to
 convert it.
 
 is there any other (better) way?
 
 weiwei
 
 On 7/13/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 
  You could use the nlines= argument to scan to read in a
  portion at a time.
 
 
 
  On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
  
   add:
   I used
   trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529,
  ncol=195)
  
   it is done.
   so it seems that I just have no patience to wait for half an hour :)
  
   but i still have that question:
   is there a way to track the process if it takes too long. Could we
   stop in the middle to see at which line it hesitates to move on?
  
   regards,
  
   weiwei
  
  
   On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
Hi,
I have a question on read.table.
   
I have a dataset with 273,000 lines and 195 columns. I used the
read.table to load the data into R:
trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
I found it takes forever.
   
then I run 1/10 of the data (test) using read.table again. And this
time it finished quickly. So, there might be something wrong in my
data format causing that problem.
   
then, my question is, is there a way in R to track at which line,
something wrong occurs?
   
Thanks,
   
Weiwei
   
   
--
Weiwei Shi, Ph.D
   
Did you always know?
No, I did not. But I believed...
---Matrix III
   
  
  
   --
   Weiwei Shi, Ph.D
  
   Did you always know?
   No, I did not. But I believed...
   ---Matrix III
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
  
 
 
 
 
 --
 Weiwei Shi, Ph.D
 
 Did you always know?
 No, I did not. But I believed...
 ---Matrix III


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Weiwei Shi
there is another problem since last time i forgot byrow :(
 trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529, 
 ncol=195, byrow=T)
Read 53338155 items
Error: cannot allocate vector of size 416704 Kb

please help with this 'simple' reading task.

weiwei

On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
 that sort of works for my purpose.
 
 btw, is there a bettter way to get data.frame by passing around
 matrix(). Since I could not find data.frame() with nrow or ncol
 arguments. so i have to use matrix first and then as.data.frame to
 convert it.
 
 is there any other (better) way?
 
 weiwei
 
 On 7/13/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 
  You could use the nlines= argument to scan to read in a
  portion at a time.
 
 
 
  On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
  
   add:
   I used
   trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529,
  ncol=195)
  
   it is done.
   so it seems that I just have no patience to wait for half an hour :)
  
   but i still have that question:
   is there a way to track the process if it takes too long. Could we
   stop in the middle to see at which line it hesitates to move on?
  
   regards,
  
   weiwei
  
  
   On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
Hi,
I have a question on read.table.
   
I have a dataset with 273,000 lines and 195 columns. I used the
read.table to load the data into R:
trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
I found it takes forever.
   
then I run 1/10 of the data (test) using read.table again. And this
time it finished quickly. So, there might be something wrong in my
data format causing that problem.
   
then, my question is, is there a way in R to track at which line,
something wrong occurs?
   
Thanks,
   
Weiwei
   
   
--
Weiwei Shi, Ph.D
   
Did you always know?
No, I did not. But I believed...
---Matrix III
   
  
  
   --
   Weiwei Shi, Ph.D
  
   Did you always know?
   No, I did not. But I believed...
   ---Matrix III
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
  
 
 
 
 
 --
 Weiwei Shi, Ph.D
 
 Did you always know?
 No, I did not. But I believed...
 ---Matrix III
 


-- 
Weiwei Shi, Ph.D

Did you always know?
No, I did not. But I believed...
---Matrix III

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Gabor Grothendieck
Try reading it into and transposing the matrix afterwards.  Don't know if
that would work but its worth a try.  Actually if you
are having problems read it into a vector, check that its of the required
size, just in case, and then turn it into a matrix and transpose it.


On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
 there is another problem since last time i forgot byrow :(
  trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529, 
  ncol=195, byrow=T)
 Read 53338155 items
 Error: cannot allocate vector of size 416704 Kb
 
 please help with this 'simple' reading task.
 
 weiwei
 
 On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
  that sort of works for my purpose.
 
  btw, is there a bettter way to get data.frame by passing around
  matrix(). Since I could not find data.frame() with nrow or ncol
  arguments. so i have to use matrix first and then as.data.frame to
  convert it.
 
  is there any other (better) way?
 
  weiwei
 
  On 7/13/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  
   You could use the nlines= argument to scan to read in a
   portion at a time.
  
  
  
   On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
   
add:
I used
trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529,
   ncol=195)
   
it is done.
so it seems that I just have no patience to wait for half an hour :)
   
but i still have that question:
is there a way to track the process if it takes too long. Could we
stop in the middle to see at which line it hesitates to move on?
   
regards,
   
weiwei
   
   
On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
 Hi,
 I have a question on read.table.

 I have a dataset with 273,000 lines and 195 columns. I used the
 read.table to load the data into R:
 trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
 I found it takes forever.

 then I run 1/10 of the data (test) using read.table again. And this
 time it finished quickly. So, there might be something wrong in my
 data format causing that problem.

 then, my question is, is there a way in R to track at which line,
 something wrong occurs?

 Thanks,

 Weiwei


 --
 Weiwei Shi, Ph.D

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III

   
   
--
Weiwei Shi, Ph.D
   
Did you always know?
No, I did not. But I believed...
---Matrix III
   
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
   http://www.R-project.org/posting-guide.html
   
  
  
 
 
  --
  Weiwei Shi, Ph.D
 
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
 
 
 
 --
 Weiwei Shi, Ph.D
 
 Did you always know?
 No, I did not. But I believed...
 ---Matrix III


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Weiwei Shi
i think what you meant is
 trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=195, 
 ncol=273529)
and then transpose it. However:
Error: cannot allocate vector of size 512000 Kb

the answer is no :(

I think i am going to write my own function to split the result from
scan but not sure if it can be made into matrix or not even if I
succeed.


On 7/13/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Try reading it into and transposing the matrix afterwards.  Don't know if
 that would work but its worth a try.  Actually if you
 are having problems read it into a vector, check that its of the required
 size, just in case, and then turn it into a matrix and transpose it.
 
 
 On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
  there is another problem since last time i forgot byrow :(
   trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529, 
   ncol=195, byrow=T)
  Read 53338155 items
  Error: cannot allocate vector of size 416704 Kb
 
  please help with this 'simple' reading task.
 
  weiwei
 
  On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
   that sort of works for my purpose.
  
   btw, is there a bettter way to get data.frame by passing around
   matrix(). Since I could not find data.frame() with nrow or ncol
   arguments. so i have to use matrix first and then as.data.frame to
   convert it.
  
   is there any other (better) way?
  
   weiwei
  
   On 7/13/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
   
You could use the nlines= argument to scan to read in a
portion at a time.
   
   
   
On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:

 add:
 I used
 trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529,
ncol=195)

 it is done.
 so it seems that I just have no patience to wait for half an hour :)

 but i still have that question:
 is there a way to track the process if it takes too long. Could we
 stop in the middle to see at which line it hesitates to move on?

 regards,

 weiwei


 On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
  Hi,
  I have a question on read.table.
 
  I have a dataset with 273,000 lines and 195 columns. I used the
  read.table to load the data into R:
  trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
  I found it takes forever.
 
  then I run 1/10 of the data (test) using read.table again. And this
  time it finished quickly. So, there might be something wrong in my
  data format causing that problem.
 
  then, my question is, is there a way in R to track at which line,
  something wrong occurs?
 
  Thanks,
 
  Weiwei
 
 
  --
  Weiwei Shi, Ph.D
 
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
 


 --
 Weiwei Shi, Ph.D

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

   
   
  
  
   --
   Weiwei Shi, Ph.D
  
   Did you always know?
   No, I did not. But I believed...
   ---Matrix III
  
 
 
  --
  Weiwei Shi, Ph.D
 
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
 
 


-- 
Weiwei Shi, Ph.D

Did you always know?
No, I did not. But I believed...
---Matrix III

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-07-13 Thread Weiwei Shi
Sorry for last post. 
I don't know why i got the error message last time.
but if i did in the following way:
t-scan('train1.dat',  sep='|', na.string='.')
t2-matrix(t, nrow=195, ncol=273529)
t3-t(t2)
t4-as.data.frame(t3)

now I got what i needed.

Thanks a lot for Gabor's prompt help.

weiwei

On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
 i think what you meant is
  trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=195, 
  ncol=273529)
 and then transpose it. However:
 Error: cannot allocate vector of size 512000 Kb
 
 the answer is no :(
 
 I think i am going to write my own function to split the result from
 scan but not sure if it can be made into matrix or not even if I
 succeed.
 
 
 On 7/13/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  Try reading it into and transposing the matrix afterwards.  Don't know if
  that would work but its worth a try.  Actually if you
  are having problems read it into a vector, check that its of the required
  size, just in case, and then turn it into a matrix and transpose it.
 
 
  On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
   there is another problem since last time i forgot byrow :(
trn-matrix(scan('train1.dat',  sep='|', na.string='.'), nrow=273529, 
ncol=195, byrow=T)
   Read 53338155 items
   Error: cannot allocate vector of size 416704 Kb
  
   please help with this 'simple' reading task.
  
   weiwei
  
   On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
that sort of works for my purpose.
   
btw, is there a bettter way to get data.frame by passing around
matrix(). Since I could not find data.frame() with nrow or ncol
arguments. so i have to use matrix first and then as.data.frame to
convert it.
   
is there any other (better) way?
   
weiwei
   
On 7/13/05, Gabor Grothendieck [EMAIL PROTECTED] wrote:

 You could use the nlines= argument to scan to read in a
 portion at a time.



 On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
 
  add:
  I used
  trn-matrix(scan('train1.dat',  sep='|', na.string='.'), 
  nrow=273529,
 ncol=195)
 
  it is done.
  so it seems that I just have no patience to wait for half an hour :)
 
  but i still have that question:
  is there a way to track the process if it takes too long. Could we
  stop in the middle to see at which line it hesitates to move on?
 
  regards,
 
  weiwei
 
 
  On 7/13/05, Weiwei Shi [EMAIL PROTECTED] wrote:
   Hi,
   I have a question on read.table.
  
   I have a dataset with 273,000 lines and 195 columns. I used the
   read.table to load the data into R:
   trn-read.table('train1.dat', header=F, sep='|', na.strings='.')
   I found it takes forever.
  
   then I run 1/10 of the data (test) using read.table again. And 
   this
   time it finished quickly. So, there might be something wrong in my
   data format causing that problem.
  
   then, my question is, is there a way in R to track at which line,
   something wrong occurs?
  
   Thanks,
  
   Weiwei
  
  
   --
   Weiwei Shi, Ph.D
  
   Did you always know?
   No, I did not. But I believed...
   ---Matrix III
  
 
 
  --
  Weiwei Shi, Ph.D
 
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 


   
   
--
Weiwei Shi, Ph.D
   
Did you always know?
No, I did not. But I believed...
---Matrix III
   
  
  
   --
   Weiwei Shi, Ph.D
  
   Did you always know?
   No, I did not. But I believed...
   ---Matrix III
  
 
 
 
 --
 Weiwei Shi, Ph.D
 
 Did you always know?
 No, I did not. But I believed...
 ---Matrix III
 


-- 
Weiwei Shi, Ph.D

Did you always know?
No, I did not. But I believed...
---Matrix III

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table with header and text data

2005-04-06 Thread Laura Holt
Hi R!
I am reading in a text file which has one column of alpha data and 5 columns 
of numeric data.

There is a header row.
I would like the alpha data column to just be character rather than factor.
Is there a way to do this, please?  I'm thinking that it might be I() but 
can't figure out exactly how.

Thanks,
Laura
mailto: [EMAIL PROTECTED]
R 2.0.1 Windows
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table with header and text data

2005-04-06 Thread Rich FitzJohn
See ?read.table, especially the argument as.is.

Cheers,
Rich

On Apr 7, 2005 9:55 AM, Laura Holt [EMAIL PROTECTED] wrote:
 Hi R!
 
 I am reading in a text file which has one column of alpha data and 5 columns
 of numeric data.
 
 There is a header row.
 
 I would like the alpha data column to just be character rather than factor.
 
 Is there a way to do this, please?  I'm thinking that it might be I() but
 can't figure out exactly how.
 
 Thanks,
 Laura
 mailto: [EMAIL PROTECTED]
 R 2.0.1 Windows
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


-- 
Rich FitzJohn
rich.fitzjohn at gmail.com   |http://homepages.paradise.net.nz/richa183
  You are in a maze of twisty little functions, all alike

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table

2005-02-26 Thread Tilo Blenk
Maybe argument 'fill' of read.table is the solution.
The default value is FALSE in read.table and, therefore, any line not 
having the same number of fields as the first line (not skipped) will 
make problems. If set to TRUE, as in read.delim and read.csv, lines 
with less number of fields get blank fields added at the end.

If exporting tab delimited text files from Excel lines with empty 
fields at the end in the Excel file often have less fields than the 
header line in the text file. Reading them with read.delim fixes that.

If the problem is more complicated you probably need to find the lines 
with count.fields and correct them manually.

You can find them (actually the line number) with something like
which(count.fields('data.txt') != count.fields('data.txt')[1])
assuming that the first line has the correct number of fields.
Tilo
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-02-26 Thread Uwe Ligges
Tilo Blenk wrote:
Maybe argument 'fill' of read.table is the solution.
The default value is FALSE in read.table and, therefore, any line not 
having the same number of fields as the first line (not skipped) will 
make problems. If set to TRUE, as in read.delim and read.csv, lines with 
less number of fields get blank fields added at the end.

If exporting tab delimited text files from Excel lines with empty fields 
at the end in the Excel file often have less fields than the header line 
in the text file. Reading them with read.delim fixes that.

If the problem is more complicated you probably need to find the lines 
with count.fields and correct them manually.

You can find them (actually the line number) with something like
which(count.fields('data.txt') != count.fields('data.txt')[1])
assuming that the first line has the correct number of fields.
Tilo
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

Tilo,
is this an answer to a R-help question?
If so, I'd like to suggest to cite the original post and reply also to 
the original poster who might not be a subscribed member of this list...

Uwe Ligges
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table

2005-02-26 Thread John Maindonald
In addition to other suggestions made, note also count.fields().
 cat(10 9 17  # First of 7 lines, 11 13 1 6, 9 14 16,
+ 12 15 14, 8 15 15, 9 13 12, 7 14 18,
+ file=oneBadRow.txt, sep=\n)
 nfields - count.fields(oneBadRow.txt)
 nfields
[1] 3 4 3 3 3 3 3
 table(nfields) ## Use with many records
nfields
3 4
6 1
 tab - table(nfields)
 (1:length(nfields))[nfields == 4]
[1] 2
 readLines(oneBadRow.txt, n=-1)[2]
[1] 11 13 1 6
Note the various option settings for count.fields()
John Maindonald email: [EMAIL PROTECTED]
phone : +61 2 (6125)3473fax  : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
On 26 Feb 2005, at 10:03 PM, [EMAIL PROTECTED] wrote:
From: Sean Davis [EMAIL PROTECTED]
Date: 26 February 2005 7:11:48 AM
To: r-help r-help@stat.math.ethz.ch
Subject: [R] read.table
I have a commonly recurring problem and wondered if folks would share 
tips.  I routinely get tab-delimited text files that I need to read 
in.  In very many cases, I get:

 a - read.table('junk.txt.txt',header=T,skip=10,sep=\t)
Error in scan(file = file, what = what, sep = sep, quote = quote, dec 
= dec,  :
	line 67 did not have 88 elements

I am typically able to go through the file and find a single quote or 
something like that causing the problem, but with a recent set of 
files, I haven't been able to find such an issue.  What can I do to 
get around this problem?  I can use perl, also

Thanks,
Sean
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table

2005-02-25 Thread Sean Davis
I have a commonly recurring problem and wondered if folks would share 
tips.  I routinely get tab-delimited text files that I need to read in. 
 In very many cases, I get:

 a - read.table('junk.txt.txt',header=T,skip=10,sep=\t)
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = 
dec,  :
	line 67 did not have 88 elements

I am typically able to go through the file and find a single quote or 
something like that causing the problem, but with a recent set of 
files, I haven't been able to find such an issue.  What can I do to get 
around this problem?  I can use perl, also

Thanks,
Sean
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] read.table

2005-02-25 Thread Berton Gunter
?readLines

I'm sure Perl will do nicely, but you can also use readLines and grep() or
regexpr() the result in R as you would in Perl to find where the problem
lies. ?nchar can also help to find a non-printing character that may be
messing you up. It's no fun, I know. Excel files can be a particular pain,
especially in their handling of missings.

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Sean Davis
 Sent: Friday, February 25, 2005 12:12 PM
 To: r-help
 Subject: [R] read.table
 
 I have a commonly recurring problem and wondered if folks would share 
 tips.  I routinely get tab-delimited text files that I need 
 to read in. 
   In very many cases, I get:
 
   a - read.table('junk.txt.txt',header=T,skip=10,sep=\t)
 Error in scan(file = file, what = what, sep = sep, quote = 
 quote, dec = 
 dec,  :
   line 67 did not have 88 elements
 
 I am typically able to go through the file and find a single quote or 
 something like that causing the problem, but with a recent set of 
 files, I haven't been able to find such an issue.  What can I 
 do to get 
 around this problem?  I can use perl, also
 
 Thanks,
 Sean
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] read.table

2005-02-25 Thread Ted Harding
On 25-Feb-05 Sean Davis wrote:
 I have a commonly recurring problem and wondered if folks
 would share tips.  I routinely get tab-delimited text files
 that I need to read in.
   In very many cases, I get:
 
   a - read.table('junk.txt.txt',header=T,skip=10,sep=\t)
 Error in scan(file = file, what = what, sep = sep, quote = quote,
 dec = dec,  :
   line 67 did not have 88 elements
 
 I am typically able to go through the file and find a single
 quote or something like that causing the problem, but with a
 recent set of files, I haven't been able to find such an issue.
 What can I do to get around this problem?  I can use perl, also

Hi Sean,

This is only a shot in the dark, but your description has reminded
me of similar messes in files which have been exported from Excel.

What I have often done in such cases, to check (e.g.) the numbers
of fields in records (using 'awk' on Linux) is on the following
lines:

  cat filename | awk 'BEGIN{FS=\t} {print NF}' | unique

In that case, if there are varying numbers of fields then
two or more different numbers will be printed instead of
the single value which it should be.

If you know how many fields to expect (e.g. 88), then you can
find the line numbers of offending records by something like

  cat filename | awk 'BEGIN{FS=\t} {if(NF!=88){print NR}}'

In data files with a lot of records per line, doing it in
this kind of way is vastly superior to trying to spot the
problem by eye -- it's extemely difficult to count 88
tab-separated fields on screen!

Hoping this helps! If not, supply further details and we'll
see what we can think up.

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 25-Feb-05   Time: 20:54:43
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] read.table

2005-02-25 Thread Ted Harding
On 25-Feb-05 Ted Harding wrote:
 On 25-Feb-05 Sean Davis wrote:
 I have a commonly recurring problem and wondered if folks
 would share tips.  I routinely get tab-delimited text files
 that I need to read in.
   In very many cases, I get:
 
   a - read.table('junk.txt.txt',header=T,skip=10,sep=\t)
 Error in scan(file = file, what = what, sep = sep, quote = quote,
 dec = dec,  :
   line 67 did not have 88 elements
 
 I am typically able to go through the file and find a single
 quote or something like that causing the problem, but with a
 recent set of files, I haven't been able to find such an issue.
 What can I do to get around this problem?  I can use perl, also
 
 Hi Sean,
 
 This is only a shot in the dark, but your description has reminded
 me of similar messes in files which have been exported from Excel.
 
 What I have often done in such cases, to check (e.g.) the numbers
 of fields in records (using 'awk' on Linux) is on the following
 lines:
 
   cat filename | awk 'BEGIN{FS=\t} {print NF}' | unique

OOPS!!!

  cat filename | awk 'BEGIN{FS=\t} {print NF}' | uniq

Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 25-Feb-05   Time: 21:14:55
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-02-25 Thread Peter Dalgaard
Berton Gunter [EMAIL PROTECTED] writes:

 ?readLines
 
 I'm sure Perl will do nicely, but you can also use readLines and grep() or
 regexpr() the result in R as you would in Perl to find where the problem
 lies. ?nchar can also help to find a non-printing character that may be
 messing you up. It's no fun, I know. Excel files can be a particular pain,
 especially in their handling of missings.

You might also try read.delim() which has options set specifically to
be able to read Excel-generated CSV files.

Also check out count.fields().

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table

2005-02-25 Thread Peter Dalgaard
Peter Dalgaard [EMAIL PROTECTED] writes:

 You might also try read.delim() which has options set specifically to
 be able to read Excel-generated CSV files.

Blah.

*TAB-delimited* files of course. read.csv() for the other ones.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table from a list of filenames

2004-12-28 Thread thomas hills
I am wondering if it is possible to read.table repeatedly from a list 
of file names into a new list of table names.

For example:

filenames - list.files()

then with a function like

rf - function(i) {
word??(filename[i]) - read.table(filenames[i]) }

I can't seem to find a function like word?? that will be the object of 
another operation.   If this worked, then I could repeat it for the 
length of filenames.

Also, even the following function seems to give me an error, but I 
don't yet know why.

rf - function(nam, i) {  nam - read.table(filenames[i]) }


Any help would be very much appreciated.

Thanks,
Thomas
[[alternative text/enriched version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] read.table from a list of filenames

2004-12-28 Thread Liaw, Andy
The solution is in section 7.21 of the R FAQ.  BTW, `rf' is a built-in R
function for generating random numbers from an F distribution, so better use
some other name.

Andy

 From: thomas hills
 
 I am wondering if it is possible to read.table repeatedly from a list 
 of file names into a new list of table names.
 
 For example:
 
 filenames - list.files()
 
 then with a function like
 
 rf - function(i) {
 word??(filename[i]) - read.table(filenames[i]) }
 
 I can't seem to find a function like word?? that will be the 
 object of 
 another operation.   If this worked, then I could repeat it for the 
 length of filenames.
 
 Also, even the following function seems to give me an error, but I 
 don't yet know why.
 
 rf - function(nam, i) {  nam - read.table(filenames[i]) }
 
 
 Any help would be very much appreciated.
 
 Thanks,
 Thomas
   [[alternative text/enriched version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table from a list of filenames

2004-12-28 Thread Thomas Lumley
On Tue, 28 Dec 2004, thomas hills wrote:
I am wondering if it is possible to read.table repeatedly from a list
of file names into a new list of table names.
For example:
filenames - list.files()
then with a function like
rf - function(i) {
word??(filename[i]) - read.table(filenames[i]) }
lapply(filenames, read.table)
will do what I think you want to do.
[It is possible to assign each file to a variable whose name is given by
 another variable, and FAQ 7.21 tells you how, but that probably isn't a
 good idea.]
-thomas
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table from a list of filenames

2004-12-28 Thread Peter Dalgaard
thomas hills [EMAIL PROTECTED] writes:

 I am wondering if it is possible to read.table repeatedly from a list 
 of file names into a new list of table names.
 
 For example:
 
 filenames - list.files()
 
 then with a function like
 
 rf - function(i) {
 word??(filename[i]) - read.table(filenames[i]) }
 
 I can't seem to find a function like word?? that will be the object of 
 another operation.   If this worked, then I could repeat it for the 
 length of filenames.
 
 Also, even the following function seems to give me an error, but I 
 don't yet know why.
 
 rf - function(nam, i) {  nam - read.table(filenames[i]) }
 
 
 Any help would be very much appreciated.

Something like

listoftables - lapply(filenames, read.table)
names(listoftables) - filenames

might be what you are looking for.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table in MacOSX

2004-10-28 Thread Matthew Forister

I'm running R version 1.9.0 on Mac OS 10.3.5.  I have created text 
files with data that I need to access from R.  When I use the 
read.table command, I get the warning message: cannot open file

These text files DO work on a Mac with a previous version of R.
I have tried pasting the data into a new text file, but I just can't 
make a file that the current version of R will open (I have tried 
this both with Word and with the native OSX text edit program).

Am I doing something wrong or is there some incompatibility here?

--
= = = = = = = =
Matthew L Forister
Section of Evolution and Ecology
2320 Storer Hall
University of California
One Shields Ave.
Davis, CA 95616
lab phone:(530) 752-2225
= = = = = = = =
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Read.Table Reading a Text file

2004-10-08 Thread Petr Pikal


On 7 Oct 2004 at 20:18, Kunal Shetty wrote:

 Dear R users and Helpers
 
 I am beginner with using R and interested in carrying out certain task
 for my statistical research. I am reading data for a text file, which
 could contain data in following pattern
 
 x y
 8 10
 1114
 1616
 1815
 6 20
 4 4
 2018
 
 As per the example I have two columns and 7 rows of data in each.
 However is real life data situation I may not know how many columns
 are present and how rows are present  and also with the certain data
 is missing. Yes I am assuming the data is delimited my Tab.
 
 
 My question or rather problem is I want read data from each colum say
 col x (8,11,16,18?.20) and store it into a variable so that I could
 perform some operations on them.

Hi

Better to read by appropriate read.whatever() function to data 
frame, see eg. ?read.table 

I hope you have already read some intro documents in which there 
is stated how you could read your data and organize them. I also 
recommend to go through Paul Johnsons Rtips. You can find it by 
e.g. Google.

Cheers
Petr



 
 I have also looked into certain R-help for Read.table and data.frame
 but still struggling on my requirement. They are
 
 http://tolstoy.newcastle.edu.au/R/help/04/07/2040.html
 http://tolstoy.newcastle.edu.au/R/help/04/07/3152.html
 
 
 Regards
 Kunal
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Read.Table Reading a Text file

2004-10-08 Thread Petr Pikal
Hi

you really should spend some time to go through introductory 
documentation and do some examples provided.

snip

On 8 Oct 2004 at 3:15, Kunal Shetty wrote:

you probably read it by read.table without saying/specifying 
header=TRUE so your X and y is included to your data not as 
names but as values. Therefore V1 and V2 are factors.

Please consult especially R-intro manual in doc directory. It helps 
you to save a lot of frustration and misunderstanding, especially at 
the begging of your work with R. 

And consider help list as a last source of help as what you have 
learned yourself you remember better and you understand better.

Cheers
Petr

 
  
 V1  V2
  1  Xy
  2  810
  3 11   1 4
  4 16   16
  5 18   15
  6  620
  7  4 4
  8 20   18
  9 2522
  
  
  and I want to access V1  values.
  
  
  thank you
  regards
  Kunal
  
  
  [EMAIL PROTECTED] wrote:
  
  
  
  
   If you have an unequal number of columns, then use 'fill=T'
   onread.table
  
   It putsNAs.
  
   Is this what youwant?
  
   Here is what happens on the input file which is your data and
   someextra
  columns:
  
   8   10
   11  14
   16  16
   18   15  12
   6   20
   44  12
   20  18
  
  
x.1 - read.table('/tempxx.txt',fill=T)
   x.1
  X8X10
   11 14 NA
   16 16 NA
   18 15 12
   6  20 NA
   4   4 12
   20 18 NA
  __
   James HoltmanWhat is the problem you are trying tosolve?
   Executive Technical Consultant  --  Office of Technology,Convergys
  [EMAIL PROTECTED]
   +1 (513)723-2929
  
  
  
   KunalShetty
   [EMAIL PROTECTED] To:[EMAIL PROTECTED]
   .educc:
   Sent by: Subject: [R] Read.Table Reading a Textfile
  [EMAIL PROTECTED]
  ath.ethz.ch
  
  
   10/07/200416:18
  
  
  
  
  
  
   Dear R users andHelpers
  
   I am beginner with using R and interested in carrying out
   certaintask
  for
   my statisticalresearch.
   I am reading data for a text file, which could contain data
   infollowing
  pattern
  
   x   y
   8   10
   11  14
   16  16
   18  15
   6   20
   4   4
   20  18
  
   As per the example I have two columns and 7 rows of data ineach.
   However is real life data situation I may not know how many
   columnsare present and how rows are present  and also with the
   certain datais missing. Yes I am assuming the data is delimited
   myTab.
  
  
   My question or rather problem is I want read data from each colum
   saycol
  x
   (8,11,16,18EUR.20) and store it into a variable so that I
   couldperform
  some
   operations onthem.
  
   I have also looked into certain R-help for Read.table and
   data.framebut still struggling on my requirement. Theyare
  
  http://tolstoy.newcastle.edu.au/R/help/04/07/2040.html
  http://tolstoy.newcastle.edu.au/R/help/04/07/3152.html
  
  
  Regards
  Kunal
  
  __
   [EMAIL PROTECTED] mailinglist
  https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the postingguide!
  http://www.R-project.org/posting-guide.html
  
  
  __
  [EMAIL PROTECTED] mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Read.Table Reading a Text file

2004-10-07 Thread Kunal Shetty
Dear R users and Helpers

I am beginner with using R and interested in carrying out certain task for my 
statistical research.
I am reading data for a text file, which could contain data in following pattern

x   y
8   10
11  14
16  16
18  15
6   20
4   4
20  18

As per the example I have two columns and 7 rows of data in each. 
However is real life data situation I may not know how many columns are present and 
how rows are present  and also with the certain data is missing. Yes I am assuming the 
data is delimited my Tab.


My question or rather problem is I want read data from each colum say col x 
(8,11,16,18….20) and store it into a variable so that I could perform some operations 
on them.

I have also looked into certain R-help for Read.table and data.frame but still 
struggling on my requirement. They are

http://tolstoy.newcastle.edu.au/R/help/04/07/2040.html
http://tolstoy.newcastle.edu.au/R/help/04/07/3152.html


Regards
Kunal

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Read.Table Reading a Text file

2004-10-07 Thread Kunal Shetty

James
   Thank you for response. I am working on treatment for missing data for both 
bivariate and multivariate normal data. Coming back to example. My problem was that 
once we do execute this command 
x.1 - read.table('/tempxx.txt', fill=T)


How can access the particular column say X8 and all it’s values so that I could assign 
some other operations on them.
Because if I say 
print.default(x.1)

the result..

   V1  V2
1  Xy
2  810
3 11   1 4
4 16   16
5 18   15
6  620
7  4 4
8 20   18
9 2522


and I want to access V1  values…..


thank you
regards
Kunal


[EMAIL PROTECTED] wrote:
 
 
 
 
 If you have an unequal number of columns, then use 'fill=T' on read.table
 
 It puts NAs.
 
 Is this what you want?
 
 Here is what happens on the input file which is your data and some extra
 columns:
 
 810
 11   14
 16   16
 18   15   12
 620
 44   12
 20   18
 
 
  x.1 - read.table('/tempxx.txt', fill=T)
  x.1
X8 X10
 11 14  NA
 16 16  NA
 18 15  12
 6  20  NA
 4   4  12
 20 18  NA
 __
 James HoltmanWhat is the problem you are trying to solve?
 Executive Technical Consultant  --  Office of Technology, Convergys
 [EMAIL PROTECTED]
 +1 (513) 723-2929
 
 
 
 Kunal Shetty
 [EMAIL PROTECTED] To: [EMAIL PROTECTED]
 .edu cc:
 Sent by: Subject: [R] Read.Table Reading a Text file
 [EMAIL PROTECTED]
 ath.ethz.ch
 
 
 10/07/2004 16:18
 
 
 
 
 
 
 Dear R users and Helpers
 
 I am beginner with using R and interested in carrying out certain task
 for
 my statistical research.
 I am reading data for a text file, which could contain data in following
 pattern
 
 xy
 810
 11   14
 16   16
 18   15
 620
 44
 20   18
 
 As per the example I have two columns and 7 rows of data in each.
 However is real life data situation I may not know how many columns are
 present and how rows are present  and also with the certain data is
 missing. Yes I am assuming the data is delimited my Tab.
 
 
 My question or rather problem is I want read data from each colum say col
 x
 (8,11,16,18….20) and store it into a variable so that I could perform
 some
 operations on them.
 
 I have also looked into certain R-help for Read.table and data.frame but
 still struggling on my requirement. They are
 
 http://tolstoy.newcastle.edu.au/R/help/04/07/2040.html
 http://tolstoy.newcastle.edu.au/R/help/04/07/3152.html
 
 
 Regards
 Kunal
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Read.Table Reading a Text file

2004-10-07 Thread Kunal Shetty


  thanks austin, it worked..it was exactly what I was looking for

regards
Kunal


Austin, Matt [EMAIL PROTECTED] wrote:
 x.1$V1
 or
 x.1[,1]
 or
 x.1['V1']
 
 and you shouldn't need to call print.default() directly, just call
 print().
 
 --Matt
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Kunal Shetty
 Sent: Thursday, October 07, 2004 18:44 PM
 To: [EMAIL PROTECTED]
 Cc: R-help
 Subject: Re: [R] Read.Table Reading a Text file
 
 
 
 James
Thank you for response. I am working on treatment for missing
 data for both bivariate and multivariate normal data. Coming back to
 example. My problem was that once we do execute this command 
 x.1 - read.table('/tempxx.txt', fill=T)
 
 
 How can access the particular column say X8 and all it's values so that I
 could assign some other operations on them.
 Because if I say 
 print.default(x.1)
 
 the result..
 
V1  V2
 1  Xy
 2  810
 3 11   1 4
 4 16   16
 5 18   15
 6  620
 7  4 4
 8 20   18
 9 2522
 
 
 and I want to access V1  values.
 
 
 thank you
 regards
 Kunal
 
 
 [EMAIL PROTECTED] wrote:
 
 
 
 
  If you have an unequal number of columns, then use 'fill=T' onread.table
 
  It putsNAs.
 
  Is this what youwant?
 
  Here is what happens on the input file which is your data and someextra
 columns:
 
  8   10
  11  14
  16  16
  18   15  12
  6   20
  44  12
  20  18
 
 
   x.1 - read.table('/tempxx.txt',fill=T)
  x.1
 X8X10
  11 14 NA
  16 16 NA
  18 15 12
  6  20 NA
  4   4 12
  20 18 NA
 __
  James HoltmanWhat is the problem you are trying tosolve?
  Executive Technical Consultant  --  Office of Technology,Convergys
 [EMAIL PROTECTED]
  +1 (513)723-2929
 
 
 
  KunalShetty
  [EMAIL PROTECTED] To:[EMAIL PROTECTED]
  .educc:
  Sent by: Subject: [R] Read.Table Reading a Textfile
 [EMAIL PROTECTED]
 ath.ethz.ch
 
 
  10/07/200416:18
 
 
 
 
 
 
  Dear R users andHelpers
 
  I am beginner with using R and interested in carrying out certaintask
 for
  my statisticalresearch.
  I am reading data for a text file, which could contain data infollowing
 pattern
 
  x   y
  8   10
  11  14
  16  16
  18  15
  6   20
  4   4
  20  18
 
  As per the example I have two columns and 7 rows of data ineach.
  However is real life data situation I may not know how many columnsare
  present and how rows are present  and also with the certain datais
  missing. Yes I am assuming the data is delimited myTab.
 
 
  My question or rather problem is I want read data from each colum saycol
 x
  (8,11,16,18âEUR¦.20) and store it into a variable so that I couldperform
 some
  operations onthem.
 
  I have also looked into certain R-help for Read.table and data.framebut
  still struggling on my requirement. Theyare
 
 http://tolstoy.newcastle.edu.au/R/help/04/07/2040.html
 http://tolstoy.newcastle.edu.au/R/help/04/07/3152.html
 
 
 Regards
 Kunal
 
 __
  [EMAIL PROTECTED] mailinglist
 https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the postingguide!
 http://www.R-project.org/posting-guide.html
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table() question

2004-03-10 Thread asemeria




I don't know read.data function, it is
a function that you have defined?
A.S.



Alessandro Semeria
Models and Simulations Laboratory
Montecatini Environmental Research Center (Edison Group),
Via Ciro Menotti 48,
48023 Marina di Ravenna (RA), Italy
Tel. +39 544 536811
Fax. +39 544 538663
E-mail: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table() question

2004-03-09 Thread Susan Lin
Hi,

In the following code, I got an error meesage if an
input file is empty, and the program stopped running.
Could someone to tell me how to handle this problem. I
want the program to keep running. Thanks.
for i in [1:3]
{  
file=paste(file, i, .dat)
x - read.data(file)
x(11)
plot(x);
dev.off()

}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table with spaces

2004-02-20 Thread AGUSTIN PEREZ MARTIN
DeaR useRs:

Excuses for my english. I am trying to read a file with my dats and the format is a 
number, 3 spaces, other number, etc...
When I use:
a-read.table(file=c:/datos2.dat,sep=)
R sais:
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
line 3 did not have 34 elements

And I see my dats and in line 3 the first number is an space (missing value)
SOS help me

Thanks.

--
 
==oOo= 
Visit my website in: 
http://users.servicios.retecal.es/aperez2
Maybe you can find something interesting
==
--

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.table with spaces

2004-02-20 Thread Robert W. Baer, Ph.D.
You should make your missing value indicator something other than your
separator indicator:
1.  Use a text editor to indicate all missing values as NA or
2.  Use a text editor to replace the 3 separator spaces with, for example, a
comma or semicolon and use the argument sep=, or sep=; which won't
trigger on ANY whitespace.

HTH,
Rob

- Original Message - 
From: AGUSTIN PEREZ MARTIN [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, February 20, 2004 8:01 AM
Subject: [R] read.table with spaces


 DeaR useRs:

 Excuses for my english. I am trying to read a file with my dats and the
format is a number, 3 spaces, other number, etc...
 When I use:
 a-read.table(file=c:/datos2.dat,sep=)
 R sais:
 Error in scan(file = file, what = what, sep = sep, quote = quote, dec =
dec,  :
 line 3 did not have 34 elements

 And I see my dats and in line 3 the first number is an space (missing
value)
 SOS help me

 Thanks.

 --

 ==oOo=
 Visit my website in:
 http://users.servicios.retecal.es/aperez2
 Maybe you can find something interesting
 ==
 --

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] read.table(..)..Help?

2003-11-20 Thread forkusam
 Hallo,
 can someone please help me.
 I have a proplem reading a file with more that one
rows.
e.g I used the function:
p-read.table(file=FILENAME , header=TRUE,sep=;)
and later used the data.Frame() function. 
It functions when the file has only a row of
variables.
When I insert the second row I get an error message.
 How do I do this

=
=
Sylvie B. Forkusam
Eppelheimer Str.52/A2-5-2
69115 Heidelberg, Germany
Tel: (0049)-06221/346913
Mobile: 0179-6816276
===

__

Free Pop-Up Blocker - Get it now

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


  1   2   >