On 2009-March-22 , at 13:06 , Nidhi Kohli wrote:
Thank you so much for the quick reply. Let me explain you what I
want. I have a data file in the following format:
0.610251D+00 0.615278D+00 0.583581D+00 0.560295D+00
0.501325D+00 0.639512D+00 0.701607D+00 0.544963D+00
0.589746D+00 0.648588D+00 0.608216D+00 0.582599D+00
0.625204D+00 0.523065D+00 0.627593D+00 0.621433D+00
0.733730D+00 0.498495D+00 0.748673D+00 0.591025D+00
0.578333D+00 0.564807D+00 0.652199D+00 0.579333D+00
I'm reading this file into a variable named congeneric (see my code)
and now trying to pick up first 20 values and need these 20 values
in a list format like
0.610251D+00 (row 1, col 1)
0.615278D+00 (row 1, col 2)
0.583581D+00 (row 1, col 3)
.......
........
Can you tell me how can i achieve this? I think i'm pretty close but
don't know how to remove the Row Name and Col. name from the
conFirstTwenty list (see my code)
Alternatives:
congeneric <- scan(textConnection("0.610251 0.615278 0.583581 0.560295
0.501325 0.639512 0.701607 0.544963
0.589746 0.648588 0.608216 0.582599
0.625204 0.523065 0.627593 0.621433
0.733730 0.498495 0.748673 0.591025
0.578333 0.564807 0.652199 0.579333"), sep=" ")
# you would use scan with the filename in which the data is, rather
than the textConnection. That's just for the purpose of the
demonstration here.
# possible outputs
congeneric[1:20]
as.list(congeneric[1:20])
for (i in 1:20) {
cat(congeneric[i],"\n")
}
JiHO
---
http://jo.irisson.free.fr/
______________________________________________
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.