Displaying 20 results from an estimated 2000 matches similar to: "How to connect R to Mysql?"
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 =
2008 Apr 11
1
SQL INSERT using RMySQL
Hi All,
I've finally gotten around to database access using R. I'm happily
extracting rows from a MySQL database using RMySQL, but am having
problems appending rows to an existing table.
What I *want* to do is to append rows to the table, allowing the
database to automatically generate primary key values. I've only
managed to add rows by using
dbWriteTable( con,
2007 Mar 20
1
RMySQL load error
I'm having trouble getting RMySQL to load. I was able to build it and install
it (RMySQL_0.5-11.tar.gz). I was also able to build and install mysql-5.0.37.
I've read many postings about this but have not found a mention of my
particular problem (some closely related). I get the "unable to load shared
library, no such file" error, but all the files do exist, RMySQL.so and
2002 Dec 18
1
A little problem handling logicals in RMySQL under R1.6.1
There is a little problem in handling logicals in RMySQL:
# here is the MySQL connection
> con
<MySQLConnection:(1816,0)>
# here is the data frame
> print(a<-data.frame(x=c(TRUE,FALSE),y=c(FALSE,TRUE)))
x y
1 TRUE FALSE
2 FALSE TRUE
# as promised, the two data frame columns are identified as logicals and
# the field types are set to tinyint
> field.types <-
2005 Mar 09
1
RMySQL installed but not availalable
I don't use MySQL but I have seen messages like this before. They often have replies which indicate that you need to follow the instructions more closely. I suggest you search the list for these previous posts as I'm sure there is help there, somewhere!
Tom
> -----Original Message-----
> From: Adriano von Sydow [mailto:pdasilva at xtra.co.nz]
> Sent: Thursday, 10 March 2005 5:13
2001 Mar 19
3
generic database access methods
I've been putting together a package that defined generic methods for
database access. The packages is called "Rdbi." It borrows as much as
possible from existing database packages / proposals. I'd like to start
a discussion about the proposed interface. Here's what I've come up
with so far:
#
# Rdbi: connectionMethods.R
#
dbConnect <- function(dbObj, ...)
2008 Jan 08
1
Problems with modifying data in a MySQL database
Using the package /RMySQL/ I have established a connection ('con1') to a MySQL-Database called 'mc'.
This database contains a table called 'mc_2000' which has 200000 observations on several
variables. One of these variables is called 'B5' (type 'double').
When I generate a numeric vector in R called 'B6' that has the same length as 'B5': How
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
2006 Mar 15
3
"\r" with RSQLite
What am I doing wrong, or is the \r that I'm getting
in the example below a bug?
> a <- (1:10)
> b <- (LETTERS[1:10])
> df <- as.data.frame(cbind(a, b))
>
> df
a b
1 1 A
2 2 B
3 3 C
4 4 D
5 5 E
6 6 F
7 7 G
8 8 H
9 9 I
10 10 J
> library(RSQLite)
> drv <- dbDriver("SQLite")
> con <- dbConnect(drv, dbname = "Test")
2006 Mar 15
3
"\r" with RSQLite
What am I doing wrong, or is the \r that I'm getting
in the example below a bug?
> a <- (1:10)
> b <- (LETTERS[1:10])
> df <- as.data.frame(cbind(a, b))
>
> df
a b
1 1 A
2 2 B
3 3 C
4 4 D
5 5 E
6 6 F
7 7 G
8 8 H
9 9 I
10 10 J
> library(RSQLite)
> drv <- dbDriver("SQLite")
> con <- dbConnect(drv, dbname = "Test")
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 from the database table contains all
elements except the headers and the
2005 Oct 27
2
RSQLite problems
Hi, I'm experimenting with using (R)SQLite to do data management. Here are
two little problems that I've encountered:
1. The presence of ',' in string values causes trouble since ',' is also the
delimiter used in the SQL statement.
2. A newline '\n' line attached to the last string value of each row.
Some examples:
> library (RSQLite)
Loading required
2009 Aug 07
1
RMySQL - overwrite record, not table
Hi, useR-
In RMySQL, how do I overwrite records? (equivalent to "replace" query).
For example, suppose that dat2 is a newer data.frame than dat1.
con <- dbConnect(MySQL())
res <- dbWriteTable(con, "DBname", dat1, row.names=F, append=T, replace=T)
res <- dbWriteTable(con, "DBname", dat2, row.names=F, append=T, replace=T)
This would not update/replace the
2002 Oct 16
5
Database newbee problem...
Hi all,
This is a potentially very stupid question about MySQL <-> R
interaction, but I have not been able to solve it.
I'm just trying to connect R to my MySQL databse, and gets this:
> library(RMySQL)
Loading required package: methods
> m <- dbDriver("MySQL")
> con <- dbConnect(m,group="testdb")
Process R segmentation fault at Wed Oct 16 07:04:30
2010 Aug 12
2
How to building my own datafile
Hi folks,
I'm prepared building my own datafiles, simple file at start, for testing
wondering how to process? Which software will be used,
MySQL/MS-SQL/MS-Excel/Open Office-Calc etc?
On searching I found r-cran-rmysql on Ubuntu repo.
Further searching I found;
RMySQL: R interface to the MySQL database
http://cran.r-project.org/web/packages/RMySQL/index.html
Whether install the above
2006 May 23
1
RMySQL on Mac OS 10.4
I have been having trouble getting RMySQL to work on Mac OS 10.4. It
was working fine for me about a year ago but I didn't touch it for a
while and several upgrades of R, MySQL, and OS X later, it is not
working.
I first had the problem that others have been having getting the
error discussed in https://stat.ethz.ch/pipermail/r-sig-mac/2005-
November/002435.html saying that
2004 May 24
1
RMySQL problem
Hi,
I'm using R 1.9.0 with RMySQL 0.5-4 and MySQL 3.23.55 on a suse 8.2 box.
I have a simulation study and (as usual for newbies in simulation, I
guess) I have a lot of data that I want to store in MySQL. I want to
write an R script that reads data from RData files and writes it to a
MySQL database.
I read some R documents (R Data Import/Export and DSC papers) but I'm
finding
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
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
2007 Jun 06
1
Question: RMySQL bulk load/update one column, dbWriteTable()?
Hi,
I have a question reading using RMySQL trying to load one R vector into a
table column. To be more specifically, the table is there populated. Now I
add a new column and want to populate this.
Can some colleagues on this list teach me how to do this? I know how to
write one R object/table into MYSQL table using dbWriteTable. But in this
situation, I just want to do one column.
Thanks