s. It works very good.Chi"
A.K.
- Original Message -
From: peter dalgaard
To: arun
Cc: kexinz ; R help
Sent: Friday, July 13, 2012 10:27 AM
Subject: Re: [R] read.table with numeric row names
On Jul 13, 2012, at 04:27 , arun wrote:
> Hello,
>
> I saw your reply in nabble.
stood from his email:
> ("Thanks. It works very good.Chi"
>
> A.K.
>
>
>
>
> - Original Message -
> From: peter dalgaard
> To: arun
> Cc: kexinz ; R help
> Sent: Friday, July 13, 2012 10:27 AM
> Subject: Re: [R] read.table with nu
Thanks all you guys' help!
--
View this message in context:
http://r.789695.n4.nabble.com/read-table-with-numeric-row-names-tp4636342p4636446.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://sta
nlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of kexinz
> Sent: Thursday, July 12, 2012 2:59 PM
> To: r-help@r-project.org
> Subject: Re: [R] read.table with numeric row nam
Try this:
> x <- read.table(text = " 2.5 3.6 7.1 7.9
+ 100 3 4 2 3
+ 200 3.1 4 3 3
+ 300 2.2 3.3 2 4", header = TRUE, check.names = FALSE)
>
> x
2.5 3.6 7.1 7.9
100 3.0 4.0 2 3
200 3.1 4.0 3 3
300 2.2 3.3 2 4
> names(x)
[1] "2.5"
ot;\\1",colnames(dat1))
> dat1
> 2.5 3.6 7.1 7.9
> 100 3.0 4.0 2 3
> 200 3.1 4.0 3 3
> 300 2.2 3.3 2 4
> plot(colMeans(dat1)~as.numeric(names(dat1)),xlab="Column_Name",ylab="Column_Mean")
>
> A.K.
>
>
>
>
> -
_Name",ylab="Column_Mean")
>
> A.K.
>
>
>
>
> - Original Message -
> From: kexinz
> To: r-help@r-project.org
> Cc:
> Sent: Thursday, July 12, 2012 2:50 PM
> Subject: [R] read.table with numeric row names
>
> I have a text file like
2 3
200 3.1 4.0 3 3
300 2.2 3.3 2 4
plot(colMeans(dat1)~as.numeric(names(dat1)),xlab="Column_Name",ylab="Column_Mean")
A.K.
- Original Message -
From: kexinz
To: r-help@r-project.org
Cc:
Sent: Thursday, July 12, 2012 2:50 PM
Subject: [R] read.table with nume
Thanks Yasir, this helps a lot.
BTW, is there an R command to read just the first line of the file?
Yasir Kaheil wrote
>
> just do this:
> colnames(r)<-substr(colnames(r),2,nchar(colnames(r)))
>
> This will remove the X.
> Later when you want to use the headed to plot something, cast it as
> n
Thanks, but I don't want to specify the column names by hand, since I have a
lot of similar files.
arun kirshna wrote
>
> Hi,
>
> Try this:
>
> dat1<-read.table(text="
> 2.5 3.6 7.1 7.9
> 100 3 4 2 3
> 200 3.1 4 3 3
> 300 2.2 3.3 2 4
> ",sep="",header=TR
just do this:
colnames(r)<-substr(colnames(r),2,nchar(colnames(r)))
This will remove the X.
Later when you want to use the headed to plot something, cast it as numeric:
plot(colMeans(r)~as.numeric(colnames(r)))
-
Yasir Kaheil
--
View this message in context:
http://r.789695.n4.nabble.com/re
rg
Cc:
Sent: Thursday, July 12, 2012 2:50 PM
Subject: [R] read.table with numeric row names
I have a text file like this
2.5 3.6 7.1 7.9
100 3 4 2 3
200 3.1 4 3 3
300 2.2 3.3 2 4
I used "r <- read.table("a.txt", header=T)"
Th
I have a text file like this
2.5 3.6 7.1 7.9
100 3 4 2 3
200 3.1 4 3 3
300 2.2 3.3 2 4
I used "r <- read.table("a.txt", header=T)"
The row names becomes X2.5, X3.6... What I need is the row names are
numeric, so I can use the row names as number
13 matches
Mail list logo