search for: dbreadtable

Displaying 20 results from an estimated 44 matches for "dbreadtable".

2012 Nov 02
1
can not read table in dbReadTable
> tbs<-dbListTables(con) > > tbs [1] "lowend" "time" "week30" "week33" "week39" "week42" > my.data.copy <- dbReadTable(tbs, "week42") Error in function (classes, fdef, mtable) : unable to find an inherited method for function "dbReadTable", for signature "character", "character" I have created tables in db. but there is this error show up when I try to read the table in...
2012 Nov 06
0
How to read all table in r using dbreadTable, autimatically read in whenever I save new table in SQLite db
HI, I got the problem. I use the following query to read table individually, how can I read all tables autimatically rather than typing "week42" "week33" in dbReadTable? library(RSQLite) library(sqldf) drv <- dbDriver("SQLite") con<-dbConnect(drv, "sqlite.db") dbListTables(con) #dbRemoveTable(con, "week39") dbDisconnect(con) week42<- dbReadTable(con, "week_42") week33<- dbReadTable(con, "week33") w...
2011 Jul 01
1
RMySQL, RODBC, dbReadTable and ISO-8859-1 (Spanish data)
Hello R users, I am reading data into R from RMySQL or SQLite databases which are in Spanish language. I am using RMySQL library and function dbReadTable but I could not get characters with ñ and tilde, instead R does put ?. In the past I could manage it modifying the R options as (using windows): op <- options() op$encoding <- "iso-8859-1" options(op) but now in ubuntu it did not work. I am working in ubuntu 10.04 and R 2.10.1....
2009 Dec 24
1
How to dbReadTable() only a limited number of rows? (RMySQL)
I only want to load a limited number of rows by dbReadTable(). I don't see an option in the help. Is there an option to do so?
2008 Nov 06
1
RMySql inserts \r when using dbWriteTable
I am using R 2.8 and the latest versions of RMySQL on a Windows XP 64 bit machine. I was wondering if someone could help me figure out how to use dbWriteTable without inserting \r into my table. Consider the following code snippet, which is run after I connect to my database. myDFOut = dbReadTable(conn, "myDF") print(myDFOut) myDFIn = data.frame(x=paste("x", 1:5, sep = ""), y = paste("y", 1:5, sep = "")) dbWriteTable(conn, name= "myDF", value = myDFIn, row.names=F, append =TRUE, eol = "\r\n" ) myDFOut = dbReadTable(conn, &...
2005 Feb 01
2
How to get a table of MySQL database as a matrix variable in R
It seems that the dbReadTable() method provided by RMySQL could not get rid of the headers, neither the index column... So 1. Can I use read.table() method to get a table of MySQL database? >From the help document the argument of 'file' of read.table() method could be a connection... 2. How can I obtain a matrix fr...
2004 Mar 05
1
Slow reshape from 5x600000 to 6311 x 132
I have a dataset that's a few hundred thousand rows from a database (read in via dbreadTable). The database is like: > str(measures) `data.frame': 609363 obs. of 5 variables: $ vih.id : int 1 2 3 4 5 6 7 8 9 10 ... $ vi.id : int 1 2 3 4 5 6 7 8 9 10 ... $ vih.value: chr "0" "1989" "0" "N/A" ... $ vih.date : chr &qu...
2008 Aug 11
1
Unwanted carriage returns storing dataframes with dbWriteTable
If I save a dataframe with a character-typed last column to a relational database with dbWriteTable, the values in the last column of the resulting table in the database will have a '\r' (carriage return) appended. If I read back the dataframe with dbReadTable the last column in the resulting dataframe has also '\r' appended (see protocol below). Setting or unsetting sql-mode (in the SQL-Server Version 5.0) to or from 'NO_BACKSLASH_ESCAPE' has no effect on this behavour ? How can I avoid these unwanted '\r'-tail ? Hansruedi...
2002 Dec 18
1
A little problem handling logicals in RMySQL under R1.6.1
...s to 0s and 1s. # And logically, the infile is written in TRUE and FALSE and finally, in MySQL # all becomes zero. Here is what we get in MySQL: # row_names x y # 1 0 0 # 2 0 0 # # So, logically this is what we get back in R: > dbWriteTable(con,"test",a) [1] TRUE > aa<-dbReadTable(con,"test") > aa x y 1 0 0 2 0 0 > # and this is clearly not what we want... # # as a crude patch I added for (i in 1:length(value)) if (class(value[[i]])=="logical") class(value[[i]])<-"integer" # before i <- match("row.names", ... in mysqlW...
2007 Oct 01
2
xyplot
...out graphs but empty! COuld you help me plase on that? Thank you in advance z1 <- dbConnect(MyData, "something", "A1", "A2") for (tt in c("xyz", "abc", "m1")) { message(paste("Here", tt, "!!!")) mydata <- dbReadTable(z1, tt) jpeg(file=paste("D:/", tt, ".jpg", sep=""), width=00, height=100) plot.method="bitmap" xyplot(MyVALUE ~ MyNo | as.character(ID), data = mydata, main = tt, xlab = " ", ylab = " ", type="l") dev.off() } -----...
2001 Mar 19
3
generic database access methods
...n object. # dbListTables <- function(conn, ...) UseMethod("dbListTables") # # Output a list of table names associated with the connection object. # Output should look like output from ls(). # dbListTables.default <- function(conn, ...) stop("Invalid connection object") dbReadTable <- function(conn, ...) UseMethod("dbReadTable") # # Analog of the read.table() function. Returns a data frame. Some # facility for converting DB types to R types is helpfull. Generally, # this will just pass a "select * from mytable" to dbSendQuery() which # returns the da...
2010 Apr 30
0
RMySQL and dates
I am trying to read and write database tables that have a date field in them. I am constructing a data.frame, then using dbWriteTable to create the table and dbReadTable to read it. >datatbl<-data.frame( dates, trialnum, fooddel, ethdel, trialtime, trialtype, deliveries, food, ethanol, fcumrec, dcumrec, rrf, rrd) >ifelse(startdate==filelist, filetbl<-datatbl,filetbl<-rbind(filetbl, datatbl)) >dbWriteTable(con, subj, as.data.frame(filetbl),...
2005 Apr 02
2
RMySQL question
Dear List, I have this little problem: I work with adiacency matrix like: data me you me 0 1 you 1 0 I store those matrix in a mysql database actually I use RMySQL with: res<-dbSendQuery(connection, "SELECT * FROM table") myDataFrame<-fetch(res) to retrive the table, and I have data me you 1 io 0 1 2 tu 1 0 I would like the first column to be seen
2012 Mar 27
1
RSqlite UPDATE command problem
...ry(RSQLite) drv<-dbDriver("SQLite") con<-dbConnect(drv,"test.db") my.data<-data.frame(countries=c("US","UK","Canada","Australia","NewZealand"),vals=c(52,36,74,10,98)) dbWriteTable(con,"testtable",my.data) q<-dbReadTable(con,"testtable") q countries vals 1 US 52 2 UK 36 3 Canada 74 4 Australia 10 5 NewZealand 98 So, say, I want to change the value for NewZealand to '21' from '98' I've tried something like this: sql<-"UPDATE testtable SET va...
2012 Nov 06
1
how Can make function for selecting the products
HI. I make this code: getdata<-function('a','b','c' ,'d','e','f'){ drv <- dbDriver("SQLite") con<-dbConnect(drv, "sqlite.db") lt<-dbListTables(con) myf<-data.frame(NULL) for (i in 1:length(lt)) { myfile<-dbReadTable(con,lt[i]) myfile1<-myfile[-c(14:44)] myfile1$MODEL<-gsub(" ", "", myfile1$MODEL) library(RSQLite) library(sqldf) my_file<-sqldf("SELECT * FROM myfile1 where MODEL in ('a','b','c' ,'d','e','f')") my.file.s...
2005 Apr 04
2
mysql retrive question
hello R-Users, I have this simple but not for me question: I do: > res<-dbSendQuery(con, "SELECT * FROM tabellaProva") > myDataFrame<-fetch(res) > myDataMatrix<-as.matrix(myDataFrame[,-1]) > namerows(myDataMatrix)<-as.character(myDataFrame[,1]) and I have: io tu io "0" "1" tu "1" "0" my problem is that the
2005 Oct 27
2
RSQLite problems
...dbms") > data (barley) > dbWriteTable (db, "barley", barley, overwrite = TRUE) [1] TRUE > barley[1:3,] yield variety year site 1 27.00000 Manchuria 1931 University Farm 2 48.86667 Manchuria 1931 Waseca 3 27.43334 Manchuria 1931 Morris > dbReadTable (db, "barley")[1:3,] yield variety year__1 site 1 27.00000 Manchuria 1931 University Farm\n 2 48.86667 Manchuria 1931 Waseca\n 3 27.43334 Manchuria 1931 Morris\n > barley$site <- as.character (barley$site) > barley$site[1] <- &qu...
2007 Mar 20
1
RMySQL load error
...t; [1] "dbConnect" [1] "dbConnect" [1] "dbDisconnect" [1] "dbSendQuery" [1] "dbGetQuery" [1] "dbGetException" [1] "dbGetInfo" [1] "dbListResults" [1] "summary" [1] "dbListTables" [1] "dbReadTable" [1] "dbWriteTable" [1] "dbWriteTable" [1] "dbExistsTable" [1] "dbRemoveTable" [1] "dbListFields" [1] "dbCommit" [1] "dbRollback" [1] "dbCallProc" [1] "MySQLResult" [1] "dbClearResult"...
2005 Mar 09
1
RMySQL installed but not availalable
...quot;dbConnect" > [1] "dbDisconnect" > [1] "dbSendQuery" > [1] "dbGetQuery" > [1] "dbGetException" > [1] "dbGetInfo" > [1] "dbListResults" > [1] "summary" > [1] "dbListTables" > [1] "dbReadTable" > [1] "dbWriteTable" > [1] "dbExistsTable" > [1] "dbRemoveTable" > [1] "dbListFields" > [1] "dbCommit" > [1] "dbRollback" > [1] "dbCallProc" > [1] "MySQLResult" > [1] "dbClearResult...
2020 Oct 02
3
Lahman Baseball Data Using R DBI Package
...eave there two out but I get error messages (in red) when I include 2B/3B or X2B/X3B. Can anyone give me some direction? Thanks, Philip Heinrich *************************************************************************************************************************************************** tail(dbReadTable(Lahman,"batting")) ID playerID yearID stint teamID team_ID lgID G G_batting AB R H X2B X3B HR RBI SB 107414 107414 yastrmi01 2019 1 SFN 2920 NL 107 NA 371 64 101 22...