Project

General

Profile

« Previous | Next » 

Revision af42291a

Added by Benoit Parmentier over 12 years ago

  • ID af42291a03207fdf7459782bbd365af26751398d

Additional changes to the loop and format

View differences:

climate/research/oregon/interpolation/Linear_reg.R
31 31
ddat <- as.list(rep("", length(dates)))
32 32

  
33 33
for(i in 1:length(dates)){
34
  data<-cat("ghcn_",dates[[1]],sep="")
35
  data<-as.data.frame(data)
36
  ddat[[i]] <- data.frame(subset(ghcn,ghcn$date_==dates[[i]]))
34
  #assign(paste("ddat",i,sep="_"),data)
35
  data_name<-cat("ghcn_",dates[[1]],sep="")
36
  #data<-as.data.frame(data)
37
  #ddat[[i]] <- data.frame(subset(ghcn,ghcn$date_==dates[[i]]))
37 38
  #data<-subset(ghcn,ghcn$date_==dates[[i]])
38
  n<-nrow(data)
39
  data<-subset(ghcn,ghcn$date_==is.numeric(dates[[i]])
40
  assign(data_name,data)
41
  n<-nrow(data[[i]])
39 42
  ns<-n-round(n*0.3)  #Create a sample from the data frame with 70% of the rows
40 43
  #ns<-n-round(n*prop)  #Create a sample from the data frame with 70% of the rows
41 44
  ind.training <- sample(nrow(data), size=ns, replace=FALSE) #This selects the index position for 70% of the rows taken randomly

Also available in: Unified diff