[Rodbcext-commits] r29 - in pkg/geoclimate: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 7 09:31:43 CEST 2012
Author: jaunario
Date: 2012-08-07 09:31:43 +0200 (Tue, 07 Aug 2012)
New Revision: 29
Modified:
pkg/geoclimate/DESCRIPTION
pkg/geoclimate/R/upload.r
Log:
Added generic, upload.weather. removed id column from upload.nasa.
Modified: pkg/geoclimate/DESCRIPTION
===================================================================
--- pkg/geoclimate/DESCRIPTION 2012-07-16 06:08:56 UTC (rev 28)
+++ pkg/geoclimate/DESCRIPTION 2012-08-07 07:31:43 UTC (rev 29)
@@ -1,7 +1,7 @@
Package: geoclimate
Type: Package
Title: Climate and Weather Data Processing at the IRRI GIS Laboratory
-Version: 0.0.10
+Version: 0.0.11
Date: 2009-2-24
Depends: methods, genutils, weather
Suggests: RODBC, RCurl
Modified: pkg/geoclimate/R/upload.r
===================================================================
--- pkg/geoclimate/R/upload.r 2012-07-16 06:08:56 UTC (rev 28)
+++ pkg/geoclimate/R/upload.r 2012-08-07 07:31:43 UTC (rev 29)
@@ -6,9 +6,9 @@
SM.update <- 1
SM.append <- 2
-.upload <- function(con, wthdframe, tablename, savemode=SM.append){
+.upload <- function(con, wthdframe, tablename, savemode=SM.append,...){
- proc <- try(sqlSave(con, wthdframe, tablename, rownames=FALSE, append=TRUE))
+ proc <- try(sqlSave(con, wthdframe, tablename, rownames=FALSE, append=TRUE,...))
success <- class(proc)!="try-error"
if(!success) show.message(proc, appendLF=TRUE)
#TODO: support transaction
@@ -22,6 +22,18 @@
return(success)
}
+upload.weather <- function(con, wth, setname,...){
+ # TODO: support transaction
+ success <- FALSE
+
+ if (class(wth)!="weather"){
+ stop("Invalid wth input. Should be class 'weather'")
+ }
+
+ success <- .upload(con, wth at w, tablename=setname,...)
+ return(success)
+}
+
upload.nasa <- function(dbasecon, nasa, setname='nasa_1d'){
# TODO: support transaction
success <- FALSE
@@ -30,8 +42,8 @@
stop("Invalid nasa input. Should be class 'weather'")
}
- inasa <- cbind(0,as.numeric(nasa at stn), nasa at w)
- colnames(inasa) <- c('id','cell', colnames(nasa at w))
+ inasa <- cbind(as.numeric(nasa at stn), nasa at w)
+ colnames(inasa) <- c('cell', colnames(nasa at w))
success <- .upload(dbasecon, inasa, tablename=setname)
return(success)
}
More information about the Rodbcext-commits
mailing list