jpm miao
2012-Jul-27 04:12 UTC
[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 [[alternative HTML version deleted]]
Jorge I Velez
2012-Jul-27 04:16 UTC
[R] How can I access the title of a table read via read.csv?
Try colnames(fx1)[2] See ?colnames HTH, Jorge.- On Fri, Jul 27, 2012 at 12:12 AM, jpm miao <> wrote:> 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 > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >[[alternative HTML version deleted]]
Daniel Nordlund
2012-Jul-27 04:22 UTC
[R] How can I access the title of a table read via read.csv?
> -----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