Hi,
I just installed ROracle and RDBI. The connection to the database seems
to work also. My problem is when I am selection rows that really exist
in the database, it is returning nothing. Where should I look to see
what could be my problem?
Thank you very much,
Mathieu
> drv <- dbDriver("Oracle")
> summary(drv, verbose=TRUE)
<OraDriver:(6721)>
Driver name: Oracle (ProC/C++)
Max connections: 10
Conn. processed: 8
Default records per fetch: 500
Oracle R/S client version: 0.5-4
RS-DBI version: 0.1-9
Open connections: 2
1 <OraConnection:(6721,0)>
2 <OraConnection:(6721,7)>
>
> conn <- dbConnect(drv, "mathieu/toto at MYDB")
> summary(conn, verbose=TRUE) <OraConnection:(6721,7)>
User: mathieu
Dbname: MYDB
Oracle Server version:
>
> rs <- dbSendQuery(conn, statement = paste("select * from cat"))
> summary(rs, verbose=TRUE)
<OraResult:(6721,7,2)>
Statement: select * from cat
Has completed? no
Affected rows: 0
Rows fetched: -1
Fields:
name Sclass type len precision scale isVarLength nullOK
1 TABLE_NAME character VARCHAR2 30 0 0 TRUE FALSE
2 TABLE_TYPE character VARCHAR2 11 0 0 TRUE TRUE
>
> myContent <- fetch(rs, n = -1)
> myContent
[1] TABLE_NAME TABLE_TYPE
<0 rows> (or 0-length row.names)
> summary(myContent, verbose=TRUE)
TABLE_NAME TABLE_TYPE
Length:0 Length:0
Class :character Class :character
Mode :character Mode :character
> summary(rs, verbose=TRUE)
<OraResult:(6721,7,2)>
Statement: select * from cat
Has completed? yes
Affected rows: 0
Rows fetched: -1
Fields:
name Sclass type len precision scale isVarLength nullOK
1 TABLE_NAME character VARCHAR2 30 0 0 TRUE FALSE
2 TABLE_TYPE character VARCHAR2 11 0 0 TRUE TRUE
ROracle and select query empty
5 messages · Mathieu Drapeau, David James, Philippe GROSJEAN +2 more
Hello, I'm working with irregular time series data. What do you all think about the strengths and weaknesses of the "zoo" and "its" packages? I've installed and skimmed the documentation on both packages. I was hoping to get a little guidance from the user community before proceeding further. In case anyone is interested in my particular problem: I'm looking at some (surface) temperature data from NOAA: http:// cdo.ncdc.noaa.gov/ulcd/ULCD It is (irregular) time series format. The NOAA data reports year, month, date, hour, and minute. I want to group the data into hourly chunks. However, sometimes there are multiple observation per hour -- i.e an observation at 3:45 and 3:56. Also, sometimes a particular hour may be missing altogether. I need to clean up the data so that each hour has one and only one data point. I'm relatively new to R, but I think I'm getting a hold on it pretty well so far. I used to do a lot with MATLAB, and there seem to be many parallels between it and R. I have background in public policy and econometrics. Thanks, David
On Aug 25, 2005, at 12:29 PM, Mathieu Drapeau wrote:
Hi, I just installed ROracle and RDBI. The connection to the database seems to work also. My problem is when I am selection rows that really exist in the database, it is returning nothing. Where should I look to see what could be my problem? Thank you very much, Mathieu
drv <- dbDriver("Oracle")
summary(drv, verbose=TRUE)
<OraDriver:(6721)>
Driver name: Oracle (ProC/C++)
Max connections: 10
Conn. processed: 8
Default records per fetch: 500
Oracle R/S client version: 0.5-4
RS-DBI version: 0.1-9
Open connections: 2
1 <OraConnection:(6721,0)>
2 <OraConnection:(6721,7)>
conn <- dbConnect(drv, "mathieu/toto at MYDB") summary(conn, verbose=TRUE) <OraConnection:(6721,7)>
User: mathieu Dbname: MYDB Oracle Server version:
rs <- dbSendQuery(conn, statement = paste("select * from cat"))
summary(rs, verbose=TRUE)
<OraResult:(6721,7,2)>
Statement: select * from cat
Has completed? no
Affected rows: 0
Rows fetched: -1
Fields:
name Sclass type len precision scale isVarLength nullOK
1 TABLE_NAME character VARCHAR2 30 0 0 TRUE FALSE
2 TABLE_TYPE character VARCHAR2 11 0 0 TRUE TRUE
myContent <- fetch(rs, n = -1) myContent
[1] TABLE_NAME TABLE_TYPE <0 rows> (or 0-length row.names)
summary(myContent, verbose=TRUE)
TABLE_NAME TABLE_TYPE Length:0 Length:0 Class :character Class :character Mode :character Mode :character
summary(rs, verbose=TRUE)
<OraResult:(6721,7,2)>
Statement: select * from cat
Has completed? yes
Affected rows: 0
Rows fetched: -1
Fields:
name Sclass type len precision scale isVarLength nullOK
1 TABLE_NAME character VARCHAR2 30 0 0 TRUE FALSE
2 TABLE_TYPE character VARCHAR2 11 0 0 TRUE TRUE
______________________________________________ R-help at 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
Hello David, You may be interested also by the regul() function and similar fro the pastecs package: it is designed to solve the kind of problems you talk about. You should read the manual, which is included. However, this manual is in French. Best, Philippe ..............................................<??}))><........ ) ) ) ) ) ( ( ( ( ( Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( ( Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Pentagone (3D08) ( ( ( ( ( Academie Universitaire Wallonie-Bruxelles ) ) ) ) ) 8, av du Champ de Mars, 7000 Mons, Belgium ( ( ( ( ( ) ) ) ) ) phone: + 32.65.37.34.97, fax: + 32.65.37.30.54 ( ( ( ( ( email: Philippe.Grosjean at umh.ac.be ) ) ) ) ) ( ( ( ( ( web: http://www.umh.ac.be/~econum ) ) ) ) ) http://www.sciviews.org ( ( ( ( ( ..............................................................
David James wrote:
Hello, I'm working with irregular time series data. What do you all think about the strengths and weaknesses of the "zoo" and "its" packages? I've installed and skimmed the documentation on both packages. I was hoping to get a little guidance from the user community before proceeding further. In case anyone is interested in my particular problem: I'm looking at some (surface) temperature data from NOAA: http:// cdo.ncdc.noaa.gov/ulcd/ULCD It is (irregular) time series format. The NOAA data reports year, month, date, hour, and minute. I want to group the data into hourly chunks. However, sometimes there are multiple observation per hour -- i.e an observation at 3:45 and 3:56. Also, sometimes a particular hour may be missing altogether. I need to clean up the data so that each hour has one and only one data point. I'm relatively new to R, but I think I'm getting a hold on it pretty well so far. I used to do a lot with MATLAB, and there seem to be many parallels between it and R. I have background in public policy and econometrics. Thanks, David On Aug 25, 2005, at 12:29 PM, Mathieu Drapeau wrote:
Hi, I just installed ROracle and RDBI. The connection to the database seems to work also. My problem is when I am selection rows that really exist in the database, it is returning nothing. Where should I look to see what could be my problem? Thank you very much, Mathieu
drv <- dbDriver("Oracle")
summary(drv, verbose=TRUE)
<OraDriver:(6721)> Driver name: Oracle (ProC/C++) Max connections: 10 Conn. processed: 8 Default records per fetch: 500 Oracle R/S client version: 0.5-4 RS-DBI version: 0.1-9 Open connections: 2 1 <OraConnection:(6721,0)> 2 <OraConnection:(6721,7)>
conn <- dbConnect(drv, "mathieu/toto at MYDB") summary(conn, verbose=TRUE) <OraConnection:(6721,7)>
User: mathieu Dbname: MYDB Oracle Server version:
rs <- dbSendQuery(conn, statement = paste("select * from cat"))
summary(rs, verbose=TRUE)
<OraResult:(6721,7,2)>
Statement: select * from cat
Has completed? no
Affected rows: 0
Rows fetched: -1
Fields:
name Sclass type len precision scale isVarLength nullOK
1 TABLE_NAME character VARCHAR2 30 0 0 TRUE FALSE
2 TABLE_TYPE character VARCHAR2 11 0 0 TRUE TRUE
myContent <- fetch(rs, n = -1) myContent
[1] TABLE_NAME TABLE_TYPE <0 rows> (or 0-length row.names)
summary(myContent, verbose=TRUE)
TABLE_NAME TABLE_TYPE Length:0 Length:0 Class :character Class :character Mode :character Mode :character
summary(rs, verbose=TRUE)
<OraResult:(6721,7,2)>
Statement: select * from cat
Has completed? yes
Affected rows: 0
Rows fetched: -1
Fields:
name Sclass type len precision scale isVarLength nullOK
1 TABLE_NAME character VARCHAR2 30 0 0 TRUE FALSE
2 TABLE_TYPE character VARCHAR2 11 0 0 TRUE TRUE
______________________________________________ R-help at 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
______________________________________________ R-help at 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
On 8/25/05, David James <djames at frontierassoc.com> wrote:
Hello, I'm working with irregular time series data. What do you all think about the strengths and weaknesses of the "zoo" and "its" packages?
I have worked on the development of zoo with Achim Zeileis so
I will just speak to that one.
The key to notice about zoo is its independence of index class
(i.e. date, time or date/time class) making it general in
nature so that you can use any one you like. It supports
all the standard date and time classes in R and you can add
your own too. In your case you probably want to use chron
(or POSIXct if you need time zones) or you could create your
own special hourly class. See the Help Desk article in
R News 4/1 for a discussion of the main classes and
see the table at the end of that article for various idioms which
you may need.
zoo supports not only irregular but also weakly regular
series (zooreg class) which are ones that have an underlying
regularity, e.g. hourly, monthly even though they may not
have every hour, month, etc. filled in.
zoo has a PDF manual available via (in R):
library(zoo)
vignette("zoo")
zoo can work together with the 'its' class and 'ts' class via as.zoo,
as.its and as.ts.
I've installed and skimmed the documentation on both packages. I was hoping to get a little guidance from the user community before proceeding further. In case anyone is interested in my particular problem: I'm looking at some (surface) temperature data from NOAA: http:// cdo.ncdc.noaa.gov/ulcd/ULCD It is (irregular) time series format. The NOAA data reports year, month, date, hour, and minute. I want to group the data into hourly chunks. However, sometimes there are multiple observation per hour -- i.e an observation at 3:45 and 3:56. Also, sometimes a particular hour may be missing altogether. I need to clean up the data so that each hour has one and only one data point.
Using the chron date/time class here is an example:
library(chron)
library(zoo)
set.seed(1)
# create zoo series with random dates/times between tt0 and tt1
# also random values
set.seed(1)
n <- 25
tt0 <- chron("01/01/90")
tt1 <- chron("01/01/00")
tt <- sort(as.numeric(tt1-tt0)*runif(n)+tt0)
z <- zoo(rnorm(n), tt) # create zoo series from values and date/times
# aggregate by hour choosing first data point if there are mulitples.
# The arguments are (1) the zoo series (2) time rounded to the hour
# (3) aggregate function to use -- indexing in this case, (4) an
# argument to the indexing function -- in this case its 1 since
# we want the first element. See ?aggregate.zoo
z.hr <- aggregate(z, chron(floor(24*as.numeric(tt))/24), "[", 1)
# plot hourly series, see ?plot.zoo
plot(z.hr)
Packages with explicit support for zoo are strucchange, dynlm
and dyn. (dyn also supports ts and its.)
I'm relatively new to R, but I think I'm getting a hold on it pretty well so far. I used to do a lot with MATLAB, and there seem to be
Check out http://cran.r-project.org/doc/contrib/R-and-octave-2.txt
many parallels between it and R. I have background in public policy and econometrics.
Check out http://cran.r-project.org/src/contrib/Views/
1 day later
Mathieu Drapeau <mathieu.drapeau at mcgill.ca> wrote:
Hi, I just installed ROracle and RDBI. The connection to the database seems to work also. My problem is when I am selection rows that really exist in the database, it is returning nothing. Where should I look to see what could be my problem?
What platform are you running R on? And what version of Oracle? This sounds very familiar... are you building ROracle on Linux? -- David Hinds