[R] How can I access the title of a table read via read.csv?

Daniel Nordlund djnordlund at frontier.com
Fri Jul 27 06:22:58 CEST 2012


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of jpm miao
> Sent: Thursday, July 26, 2012 9:12 PM
> To: r-help
> Subject: [R] How can I access the title of a table read via read.csv?
> 
> Hi,
> 
>    I have a table which I can read via read.csv:
> 
> fx1<-read.csv(file="A_FX_M.csv", header=TRUE)
> 
>     TIME   REER    NTD    JPY      GBP    HKD
> 1 198001 124.26 36.030 237.96 2.263980 4.8366
> 2 198002 126.59 36.030 244.05 2.290426 4.8765
> 3 198003 128.33 36.026 248.62 2.206045 4.9960
> 4 198004 127.85 36.063 251.67 2.215330 4.9760
> 5 198005 124.40 36.050 228.35 2.302026 4.8891
> 6 198006 124.64 36.028 218.05 2.336995 4.9017
> 7 198007 125.17 36.007 220.95 2.371917 4.9046
> 8 198008 128.87 35.966 224.45 2.369107 4.9360
> 
> .......................
> 
> 
>   How  can I access the title of the table? For example, I would like
> to access the character string "REER"; how can I do it?
> 
> 
>   Thanks,
> 
> 
> Miao
> 

Look at ?colnames.

colnames(fx1)[2]



Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA USA



More information about the R-help mailing list