similar to: RMySQL - Bulk loading data and creating FK links

Displaying 20 results from an estimated 2000 matches similar to: "RMySQL - Bulk loading data and creating FK links"

2010 Jan 25
1
RMySQL Append data.frame to table
I have a data.frame obj with 5 columns whose colnames match the fields in my "contact" table. The only other field my MySQL table has is an id field which is the PK and is set to auto increment. I'd like to load this data.frame using something like: dbWriteTable(con, "contact", dat, append=TRUE) However, I get this error: Error in mysqlExecStatement(conn, statement,
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
2010 Jan 27
2
Bulk Match/Replace
This must be easy to do..... I have a vector and a lookup data.frame: > v [1] "5" "234" "234" "42-43" "234" "42-43" "234" "234" "42-43" "234" "5" "234" "234" "5" "234" "234" "5"
2009 Oct 08
6
Eager Loading a Relationship That Has No PK/FK
I''m attempting to wrestle an old DB into Rails. This relationship is giving me trouble: class Show < AR::Base has_many :segments end class Segment < AR::Base belongs_to :show has_one :media #this has no PK/FK relation end A Segment is "linked" to Media by Media.name, which is the result of concatenating Segment.name and Segment.part. As I said there are is no
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 =
2010 Oct 13
2
Rmysql - dbWritetable
Dear Rusers, I am trying to feed my database with data from a file. But since my file (2010101000.txt) there`s no headers I am facing problem because the result data.frame is not separated my columns. How could I set variables names for each columns in *dbWriteTable*? I have tried the command below but I don`t know how to fill the *field.type*option. dbWriteTable(con, "b20101010",
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
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
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,
2010 Jul 16
1
Troubles with DBI's dbWriteTable in RMySQL
I am feeling rather dumb right now. I created what I thought was a data.frame as follows: aaa <- lapply(split(moreinfo,list(moreinfo$m_id),drop = TRUE), fun_m_id) m_id_default_res <- do.call(rbind, aaa) print("==========================================") m_id_default_res print("==========================================") ndf <- m_id_default_res[, c('mid',
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
2003 Nov 24
1
RMySQL valid field names
I'm having some problems with valid field names when using RMySQL to interface R (version 1.7.0, under RedHat9.0), to MySQL (4.1.0-alpha). I think I've spotted the problem and a solution (which is working for me), but I wanted to share this with you as I may be missing something. (Note: I'm aware that this is an old R version, but I've checked the code of the lastest version of
2010 Mar 24
1
Bulk editing of mySQL tables
Hello, I have started to use RMySQL and I would like to use R to make batch changes to data. What it the best way to do this? Is it to download the table using dbGetQuery, manipulate the data in R and then dbWriteTable to delete the existing table and replace it with the local data. What I am concerned about this is that it might lose some mySQL table configuration options and it isn't a
2010 Feb 08
2
Help with apply()
I have a 2 column data.frame: > d[1:5,] a b 1 80015 C 2 80016 B 3 80023 C 4 80062 B 5 80069 B I want to apply a function across each row: > for(i in 1:nrow(d)) { + myFun(con, d[i,]$a, d[i,]$b) + } How do I do this using apply()? I'm unsure how to tell apply() to pass data from columns a and b for a given row as arguments to the function
2010 Jan 13
1
decompress tar.gz and zip files
Can anyone point me in the right direction for decompressing text files that are compressed as tar.gz or zip files? Cheers, Nathan -- -------------------------------------------------------- Dr. Nathan S. Watson-Haigh OCE Post Doctoral Fellow CSIRO Livestock Industries University Drive Townsville, QLD 4810 Australia Tel: +61 (0)7 4753 8548 Fax: +61 (0)7 4753 8600 Web:
2010 Mar 18
1
Intersect, Union of date/time ranges
I have 2 sets of data which defines the start and end of date/time periods. I want to be able to obtain the following: 1) The intersect of those 2 sets of date/time ranges i.e. return start/end date/time ranges where both sets overlap 2) The union of those 2 sets of date/time ranges i.e. return the start/end date/time ranges which are in 1 or both sets Is there anything that is currently able
2007 May 31
1
RMySQL DBI question
Dear colleague, I have two data frame which I tried to use dbWriteTable function with append=TRUE to write to the mysql database. The problem is that if I am run my R script directly then it is fine. Both data frame got written into the database. But when I tried to embed the script to be called as system("R --save < whatever.R") in my perl script, I saw very strange things. One
2010 Feb 09
1
Superimpose ksmooth() onto barplot
I'd like to superimpose a ksmooth() onto a barplot(). My data is: > d 2009-06-20 2009-06-21 2009-06-22 2009-06-23 2009-06-24 2009-06-25 2009-06-26 2009-06-27 2009-06-28 2009-06-29 2009-06-30 2009-07-01 2009-07-02 Same Breed (B) 12.64 21.08 13.52 12.51 13.71 9.91 14.24 7.18 11.81 5.92 12.04 17.96
2006 Jun 13
2
Numerical print format and loading with RMySQL
Hi I'm new to R and have been resisting posting to the list thus far, but I think I've exhausted my work around options. I'm having a few problems with RMySQL and/or it's underlying packages. I'm doing a very simple vsn transformation on large datasets, using RMySQL to retrieve the data for a DB. My first problem was that I could not get the RMySQL package to write
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 <-