Re: [R] read.data? without separator

2010-12-27 Thread Greg Snow
Would the read.fwf function work for you?

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Fror
 Sent: Sunday, December 26, 2010 11:04 AM
 To: r-help@r-project.org
 Subject: [R] read.data? without separator
 
 
 Hello,
 
 I have a problem with read.data. For example I have a file
 
 # comment
 1?0001010101
 101010??1010
 
 with comment on first line and data layout without separator. How I
 could
 read data that each character\sign was in another column. It is trivial
 probably, but I have no idea for it.
 
 Thank's,
 Kacper
 --
 View this message in context: http://r.789695.n4.nabble.com/read-data-
 without-separator-tp3164358p3164358.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org 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@r-project.org 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.data? without separator

2010-12-26 Thread Fror

Hello,

I have a problem with read.data. For example I have a file

# comment
1?0001010101
101010??1010

with comment on first line and data layout without separator. How I could
read data that each character\sign was in another column. It is trivial
probably, but I have no idea for it.

Thank's,
Kacper
-- 
View this message in context: 
http://r.789695.n4.nabble.com/read-data-without-separator-tp3164358p3164358.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.data? without separator

2010-12-26 Thread jim holtman
I have a problem with 'read.data' also in that I don't see that as a
function in the 'base'; I assume you meant read.table.

Also you did not indicate is all the lines were the same length.  Here
is a solution to return a list is each character broken out
separately.

 x - readLines(textConnection(# comment
+ 1?0001010101
+ 101010??1010))
 closeAllConnections()
 # split lines 2-n into a list of separate characters
 result - lapply(x[-1], function(.line) strsplit(.line, '')[[1]])
 result
[[1]]
 [1] 1 ? 0 0 0 1 0 1 0 1 0 1

[[2]]
 [1] 1 0 1 0 1 0 ? ? 1 0 1 0



On Sun, Dec 26, 2010 at 1:04 PM, Fror f...@interia.pl wrote:

 Hello,

 I have a problem with read.data. For example I have a file

 # comment
 1?0001010101
 101010??1010

 with comment on first line and data layout without separator. How I could
 read data that each character\sign was in another column. It is trivial
 probably, but I have no idea for it.

 Thank's,
 Kacper
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/read-data-without-separator-tp3164358p3164358.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org 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
Data Munger Guru

What is the problem that you are trying to solve?

__
R-help@r-project.org 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.