Project

General

Profile

« Previous | Next » 

Revision d5d86bbf

Added by Benoit Parmentier about 11 years ago

modification validation script following changes in daily deviation options

View differences:

climate/research/oregon/interpolation/GAM_fusion_function_multisampling_validation_metrics.R
143 143
#### Function to create a data.frame from validation obj
144 144
extract_from_list_obj<-function(obj_list,list_name){
145 145
  list_tmp<-vector("list",length(obj_list))
146
  #for (i in 1:length(obj_list)){
147
  #  tmp<-obj_list[[i]][[list_name]] #double bracket to return data.frame
148
  #  list_tmp[[i]]<-tmp
149
  #}
146 150
  for (i in 1:length(obj_list)){
147
    tmp<-obj_list[[i]][[list_name]] #double bracket to return data.frame
148
    list_tmp[[i]]<-tmp
151
    tmp<-obj_list[[i]] #double bracket to return data.frame
152
    if(inherits(tmp,"try-error")){     
153
      print(paste("no model generated",sep=" ")) #change message for any model type...
154
      list_tmp[[i]] <- NULL #double bracket to return data.frame
155
    }else{
156
      tmp<-obj_list[[i]][[list_name]] #double bracket to return data.frame
157
      list_tmp[[i]]<-tmp
158
    }
149 159
  }
160
  #list_tmp <-list_tmp[!is.null(list_tmp)]
150 161
  tb_list_tmp<-do.call(rbind,list_tmp) #long rownames
151 162
  return(tb_list_tmp) #this is  a data.frame
152 163
}
......
157 168
  
158 169
  list_tmp<-vector("list",length(obj_list))
159 170
  for (i in 1:length(obj_list)){
160
    tmp<-obj_list[[i]][[list_name]] #double bracket to return data.frame
161
    list_tmp[[i]]<-tmp
171
    tmp<-obj_list[[i]] #double bracket to return data.frame
172
    if(inherits(tmp,"try-error")){     
173
      print(paste("no model generated",sep=" ")) #change message for any model type...
174
      list_tmp[[i]] <- NULL #double bracket to return data.frame
175
    }else{
176
      tmp<-obj_list[[i]][[list_name]] #double bracket to return data.frame
177
      list_tmp[[i]]<-tmp
178
    }
162 179
  }
180
  #list_tmp <-list_tmp[!is.null(list_tmp)]
163 181
  return(list_tmp) #this is  a data.frame
164 182
}
165 183

  

Also available in: Unified diff