[R] Dynamic Variable

From: Dan Chan <dchan_at_GFC.STATE.GA.US>
Date: Mon 29 Jan 2007 - 19:42:45 GMT


Hi all,  

I have a file with a dozen weather stations with a dozen weather variables. I am trying to get a percentile of each variable for each station. I imported the file into a data frame Data.  

To get the percentile for Temperature for Baxley weather station, I used the following 2 statements.

> BaxleyList[1] <- data.frame(quantile(subset(Data, (Name=='Baxley' &
Temp>-50), select=Temp),probs=seq(0,1,0.01),na.rm=T,names=T))

> colnames(BaxleyList)[1] <- 'Temp'
 

With this success, I want to loop through the station list. But, I ran into problem in the variable name "BaxleyList".  

I tried the following:

#StationNames

> StationNameList <- unique(Data$Name)
 

> for (i in 1:1)

{

ThisStation <- StationNameList[i]

ThisStationList <- paste(ThisStation,'List',sep="")

ThisStationList[1] <- data.frame(quantile(subset(Data, (Name==ThisStation & Temp>-50),
select=Temp),probs=seq(0,1,0.01),na.rm=T,names=T))

colnames(ThisStationList)[1] <- 'Temp'

}  

But, ThisStationList will not give me BaxleyList.  

Thank you for all your helps in advance!    

Daniel Chan

Meteorologist

Georgia Forestry Commission

P O Box 819

Macon, GA

31202

Tel: 478-751-3508

Fax: 478-751-3465  

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch 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. Received on Tue Jan 30 06:47:11 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 29 Jan 2007 - 20:30:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.