An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100120/c86ca094/attachment.pl>
R help for read.table()
5 messages · Gaurav Kumar, Dennis Murphy, Leandro Marino
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100120/609d0184/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100120/505c037b/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100120/3e2a999f/attachment.pl>
Hi,
You didnt put the parameter sep=' ' in the read.table.
If you try to see str(file), i think you are going to see only one column.
read.table("data.txt",header=FALSE,sep=' ')
Atenciosamente,
Leandro Lins Marino
Centro de Avalia??o
Funda??o CESGRANRIO
Rua Santa Alexandrina, 1011 - 2? andar
Rio de Janeiro, RJ - CEP: 20261-903
R (21) 2103-9600 R.:236
(21) 8777-7907
( leandro at cesgranrio.org.br
"Aquele que suporta o peso da sociedade
? precisamente aquele que obt?m
as menores vantagens". (SMITH, Adam)
? Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO AMBIENTE
Esta mensagem, incluindo seus anexos, pode conter informacoes privilegiadas e/ou de carater confidencial, nao podendo ser retransmitida sem autorizacao do remetente. Se voce nao e o destinatario ou pessoa autorizada a recebe-la, informamos que o seu uso, divulgacao, copia ou arquivamento sao proibidos.
Portanto, se voc? recebeu esta mensagem por engano, por favor, nos informe respondendo imediatamente a este e-mail e em seguida apague-a.
-----Mensagem original-----
De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Em nome de Gaurav Kumar
Enviada em: quarta-feira, 20 de janeiro de 2010 08:05
Para: r-help at r-project.org
Assunto: [R] R help for read.table()
I've a table containing two columns
seperated by space, as shown below.
S:C 2.011085038928
S:A 21.496800549900762
S:J 0.183181039138149
P:E 9.641984304606304
I'm reading this table inside a loop
but unable to access the first column as file[i,1].
file <-
read.table("data.txt",header=FALSE)
for ( i in 1:nrow(file))
{
cat(file[i,1],":")
pvalue <-
2*(1-pnorm(abs(file[i,2])))
cat(pvalue,"\n")
}
can anyone help me how to read the
first column.
regards
Gaurav Kumar
www.gauravkumar.org
PhD Student, Chemistry and Biomolecular Sciences, Macquarie , Sydney, Australia.
MS (Computational Biology), NCBS-TIFR, Bangalore, India.