Displaying 20 results from an estimated 2000 matches similar to: "using variable in rmysql query"
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
2010 Nov 06
1
Help required to remove \\N
Dear All,
I have .csv file it looks like this :
rawdata <- read.csv(file='/home/Mohan/Rworks/tmp/VMList_User.txt',sep='\t'
, header=FALSE)
> head(rawdata,n=5)
Tenant Domain Owner Current State
1 \\N ROOT admin Running
2 \\N ROOT admin Stopped
3 \\N ROOT admin Running
4 \\N
2010 Nov 07
3
help to sum up data frame
Dear All,
I have a data frame like this:
name ip Bsent Breceived
a 1 0.00 0.00
a 2 1.43 19.83
a 1 0.00 0.00
a 2 1.00 1.00
b 1 0.00 2.00
b 3 0.00 2.00
b 2 2.00 0.00
b 2 2.00 0.00
b 1 24.40 22.72
c
2010 Nov 09
4
help to add a new column filled with value 1
Dear All,
I have a data frame with 5 column and 201 row data. I want to add one
more column between column 1 and 2 with value of 1. So the new column
has to be the second column filled with 1. Any help will be
appreciated.
Thanks for your time.
Thanks & Rg
Mohan L
2016 Apr 18
2
lists and rownames
I'm doing some string manipulation on a vector of file names, and noticed
something curious. When I strsplit the vector, I get a list of
character vectors.
The list is numbered, as lists are. When I cast that list as a data
frame with 'as.data.frame()', the resulting columns have names derived
from the original filenames.
Example code is below. My question is, where are these names
2011 Oct 19
4
Using SQL "IN" with RJDBC or RMySQL
Hello,
The code below works fine up until I try to use the "IN" statement in
the last line. The proper SQL format is:
SELECT * FROM this_table WHERE this_column IN (1,2,3,4,5)
But, I think I may be getting something like:
SELECT * FROM this_table WHERE this_column IN c(1,2,3,4,5)
Which makes no sense in SQL. I think it may be just a matter of string
massaging, but I'm not
2011 Feb 09
2
Insert variable in RMySQL-Statement
Dear list,
I'm working with a MySQL-Table and would like to extract selected ids that are stored in a vector:
Ids <- c(1,2,3)
How do I insert this variable in a for loop like this:
For (a in values) {
Temp <- dbGetQuery(con,
"select * from db
Where id = <ID>";)
}
My problem is to split the select-statement and insert the current id. How can I handle this problem?
2011 Mar 23
1
using R variables in RMySQL query
I have the following function
myGetstockdataMySQL <- function(startdate, enddate, ticker) {
con <- dbConnect(MySQL(), user="blahblah", password="blahblah",
dbname="blahblah",
host="localhost")
rs <- dbGetQuery(con, "SELECT price.close FROM price INNER JOIN stocks ON
stocks.stock_id=price.stock_ID
WHERE (price.date_holding BETWEEN
2007 Sep 27
1
RMySQL NA/NULL value storage error
Greetings all,
I am running R 2.5.1, RMySQL 0.6 , and DBI 0.2-3 on Windows XP
Like others, I am having trouble with NA/Null value conversions between R
and a MySQL database via DBI, but I could not find my exact problem in the
archives. Most of the time NA values in R get transferred correctly to the
database and back again, unless (apparently) if they are in the last column
of the table being
2005 May 02
2
RMySQL query: why result takes so much memory in R ?
Hi
I just started with RMySQL. I have a database with roughly 12 millions
rows/records and 8 columns/fields.
From all 12 millions of records I want to import 3 fields only.
The fields are specified as:id int(11), group char(15), measurement
float(4,2).
Why does this take > 1G RAM? I run R on suse linux, with 1G RAM and with
the code below it even fills the whole 1G of swap. I just
2010 Nov 09
2
help to merge two data frame if name matches
Dear All,
I have two data like this :
$cat main.csv
name,id,memory,storage
mohan,1,100.20,1.10
ram,1,200,100
kumar,1,400,50
xxx,1,100,40
aaa,1,800,45
mount,1,200,80
> main <- read.csv(file='main.csv',sep=',' , header=TRUE)
> main
name id memory storage
1 mohan 1 100.2 10
2 ram 1 200.0 100
3 kumar 1 400.0 50
4 xxx 1
2005 Oct 19
1
Socks under R
Hi
when I use
con1 <- socketConnection(...)
in R and want to send text from another application written in Delphi to
R, do I just have to send the text or do I have to implement more
control characters and so on?
Is
con1 <- socketConnection(port=6011, server=TRUE)
writeLines("plot(rnorm(100))", con1)
just sending the text in "plot(rnorm(100))" to the socket or is
2002 Jan 26
1
Trouble with contrasts
Greetings,
I have a nagging problem with contrasts and I can't seem to resolve it.
A factor exists with four levels (lib1, lib2, con1, con2) and when I
check the contrasts or set the contrasts to any of the prespecified
ones, I do not get the exact contrasts necessary to test the
theoretically relevant ones. I need orthogonal contrasts that look just
like this matrix:
con1 con2
2009 Jan 19
1
[Win] Hangup RGui with RMySQL (PR#13453)
Full_Name: Apfel Schmied
Version: 2.8.1 (2008-12-22)
OS: WinXP SP2
Submission from: (NULL) (134.106.122.139)
RMySQL Version: 0.7-2
DBI Version: 0.2-4
MySQL Version: 5.1.30 (Enviroment Variable MYSQL_HOME is set)
Updated R from 2.60 to 2.8.1. Now Gui.exe hangs up (100% CPU Useage) when
requesting data from a mysql database.
Example Code:
2002 Sep 23
1
socket bug ??? (PR#2056)
Please help me,
I use R-1.4.1 and everything works fine. But with R-1.5.1 ist does'nt work:
I have this put into a file called "socket.R"
while(TRUE){
con1 <- socketConnection(host="localhost",port=6021,server=TRUE);
source(con1);
close(con1);
}
So I can use R with:
source("socket.R")
and R answers me when I send a command to it via socket 6021. But in
2007 May 28
1
command demands double quotes
I have an application called dynaterm which I can run successfully under
wine but to achieve 110% success I need to pass this application a parameter
which must contain double quotes
E.G. C:/Program Files/dynaterm8/dynaterm.exe -connect:"con1"
So I've tried escaping the quotes and setting the launcher command to
wine "C:/Program Files/dynaterm8/dynaterm.exe
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",
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,
2009 Jan 10
0
RMySQL CREATE TABLE error
Hi all-
I am stumped. The code in A. returns errors at lines 14 and 15 and fails
to load series1 and series2. However, in B., if temp1 and temp2 are
called again (which returns a "Table exists" error; see lines 14-17 in
B.) series1 and series2 load correctly. Any ideas? Also-I am open to any
suggestions to improve the code as I am a horrific programmer. Thanks
A.
1 >
2002 Sep 12
1
DBI / MySQL problems
Hi.
I frequently use RMySQL package to interface R with MySQL databases. I was
having a try with package DBI and I got the following error:
> library(RMySQL)
> library(DBI)
> drv <- dbDriver("MySQL")
> ch <- dbConnect(drv, dbname="mydb", user="myuser", password="mypasswd")
> ibm <- dbGetQuery(ch,"select * from table where