On Jun 1, 2012, at 12:27 PM, pigpigmeow wrote:
Dear all,
I have a lot of problems on R-programming.
for example
my csv. file is ..
That certainly does not look like any csv file I have ever seen.
Date wrfRH wrfsolar wrfwindspeed wrfrain wrftd wrfta
21/10/2010 92.97 22.11 53.27 0 1546.337861 61.00852664
22/10/2010 87.35 21.99 40.89 0 1300.408288 62.85352227
23/10/2010 88.38 21.71 28.04 0.01 1381.768284 54.80594493
24/10/2010 92.32 15.45 22.38 0.51 1113.90981 39.46573663
25/10/2010 93.42 21.59 35.5 0.52 868.4895334 28.42952321
26/10/2010 93.38 20.15 42.58 0.07 1404.722837 40.29300856
i calculate the ratio of wrfRH/wrfsolar for each day.
If you are confused in your terminology, and you really have a
data.frame created by read.table, then adding a column to an existing
data.frame , say the ratio of wrftd divided by wrfta, is really simple:
dfrm$ratio <- with dfrm, wrftd/wrfta)
that is
Date wrfRH wrfsolar wrfwindspeed wrfrain wrftd
wrfta ratio
21/10/2010 92.97 22.11 53.27 0 1546.337861 61.00852664 XXXX
22/10/2010 87.35 21.99 40.89 0 1300.408288 62.85352227 YYYY
23/10/2010 88.38 21.71 28.04 0.01 1381.768284 54.80594493 ZZZZ
24/10/2010 92.32 15.45 22.38 0.51 1113.90981 39.46573663 AAAA
25/10/2010 93.42 21.59 35.5 0.52 868.4895334 28.42952321 BBBB
26/10/2010 93.38 20.15 42.58 0.07 1404.722837 40.29300856 CCCC
how to add new column in the original file ? Anyone can help me?!
--
View this message in context:
http://r.789695.n4.nabble.com/Adding-a-column-into-the-file-tp4632093.html
Sent from the R help mailing list archive at Nabble.com.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.