Displaying 20 results from an estimated 3000 matches similar to: "Sqldf INSERT INTO"
2011 Apr 18
2
SQLDF syntax
Hi,
I am new to R and trying to migrate from SAS. I am trying to use sqldf to
create a new table from existed table and change some of the columns. I have
table called DataOld with columns commodity, rate and total and I am trying
to create new table called DataNew with columns commodity, ratenew and
totalNew.
> sqldf("create table datanew as select commodity, ratenew as rate * 10,
>
2007 Sep 07
3
Delete query in sqldf?
Dear All,
Is sqldf equipped with delete queries? I have tried delete queries but
with no success.
Thanks in advance,
Paul
2012 Aug 20
1
function case in sqldf (datas from oracle) with a null value
I use sqldf to join 2 dataframes from 2 distinct databases : a and b come
from old sqldf's.
sqldf("select a.*, b.*, case a.QTY when null then b.QTY else a.QTY end as
NEW_QTY"
from a inner join b on a.OBJECT=b.OBJECT")
R doesn't understand "when null". I tried with "when NA", "when '' ", "when
' ' " but it doesn't
2009 Dec 24
3
help in merging
Hi All,
I want to "merge" two datasets by column "ID" and I don't want the result to
be sorted by "ID". I am doing the following:
> z = merge(x, y, by = "ID", sort=F)
The result is not sorted by "ID". But (as oppose to what I expected) it is
not even in the original order of either "x" or "y".
Can
2010 Jun 27
2
Ways to work with R and Postgres
Hi,
I post this message to the general r-help list hoping anyone within a wider range have suggestions:
There are three ways to integration R and postgres, especially on 64bit Microsoft windows Platform,
1. via RODBC package, which has 32 bit and 64 bit version for windows
2. via RPostgres interface, which only has 32bit version currently
3. via plr for Greenplum, which only supports a
2024 Dec 12
1
SQL and R
The advantages of SQL are that
- it can be used from many languages so if you know SQL you can easily
move that part of your code to python, say,
and visa versa
- it is widely used
- it can handle data stored outside of R and possibly otherwise too large for R
- some SQL databases support multiple concurrent users
- depending on the database it may be used to communicate the data to others
- one
2018 Jul 23
2
oddity in transform
Note the inconsistency in the names in these two examples. X.Time in
the first case and Time.1 in the second case.
> transform(BOD, X = BOD[1:2] * seq(6))
Time demand X.Time X.demand
1 1 8.3 1 8.3
2 2 10.3 4 20.6
3 3 19.0 9 57.0
4 4 16.0 16 64.0
5 5 15.6 25 78.0
6 7 19.8 42 118.8
>
2010 Mar 11
3
Define column names to a series of data.frames
Greets to the list!
I am aware that this topic has been discussed several times. And I've
read quite some related posts [1]. Yet, can't seem to give a solution to
my problem.
I have 6 data frames consisting of 6 rows x 7 columns put together from
other data.frames.
Something like:
a b c d e f g
v1 # # # # # # #
v2 # # # # # # #
v3 # # # # # # #
v4 # # # # # # #
v5 # # # # # # #
v6
2007 Nov 24
5
how to calculate the return?
Hi, R-users,
data is a matrix like this
AMR BS GE HR MO UK SP500
1974 -0.3505 -0.1154 -0.4246 -0.2107 -0.0758 0.2331 -0.2647
1975 0.7083 0.2472 0.3719 0.2227 0.0213 0.3569 0.3720
1976 0.7329 0.3665 0.2550 0.5815 0.1276 0.0781 0.2384
1977 -0.2034 -0.4271 -0.0490 -0.0938 0.0712 -0.2721 -0.0718
1978 0.1663 -0.0452 -0.0573 0.2751 0.1372 -0.1346
2010 May 20
1
sqldf: issues with natural joins
Hello,
I'm having trouble discovering what's going wrong with my use of natural
joins via sqldf.
Following the instructions under 4i at http://code.google.com/p/sqldf/,
which discusses creating indices to speed joins, I have been only unreliably
able to get natural joins to work.
For example,
> Tid <- c('AES 01-01-02 10:58:00', 'AES 01-01-02 11:53:00', 'AES
2009 Dec 25
0
sqldf 0.2-0
A new version of sqldf, version 0.2-0, has been uploaded to CRAN and
should be available on most mirrors by now.
NEW
- works with the new version of DBI package, DBI 0.2-5. The default
action of this version of DBI quotes those column names in select
statements that are SQL reserved words (rather than appending __1 to
them which was the previous default action). As a result it should no
2009 Dec 25
0
sqldf 0.2-0
A new version of sqldf, version 0.2-0, has been uploaded to CRAN and
should be available on most mirrors by now.
NEW
- works with the new version of DBI package, DBI 0.2-5. The default
action of this version of DBI quotes those column names in select
statements that are SQL reserved words (rather than appending __1 to
them which was the previous default action). As a result it should no
2018 Jul 24
2
oddity in transform
The idea is that one wants to write the line of code below
in a general way which works the same
whether you specify ix as one column or multiple columns but the naming entirely
changes when you do this and BOD[, 1] and transform(BOD, X=..., Y=...) or
other hard coding solutions still require writing multiple cases.
ix <- 1:2
transform(BOD, X = BOD[ix] * seq(6))
On Tue, Jul 24, 2018 at
2011 Mar 09
2
SQLDF - Submitting Queries with R Objects as Columns
Fellow R programmers,
I'd like to submit SQLDF statements with R objects as column names.
For example, I want to assign "X" to "var1" (var1<-"X") and then refer to
"var1" in the SQLDF statement. SQLDF needs to understand that when I
reference "var1", it should look for "X" in the dataframe.
This is necessary because my SQLDF
2012 Jan 23
1
sqldf + Date class. Ordering and summary statistics appear to be incorrect.
I've been using sqldf heavily lately but have encountered problems
with ordering of observations or calculating statistics such as max()
and min() when the variable used is of class Date.
For example, if I run the following code:
=============== begin code =================
library(sqldf)
2008 Aug 28
3
drop unused levels in sqldf
Hi,
sqldf is a fantastic package, but when the SELECT procedure runs unused
levels remain in the output. I tried with the drop function, but without
success. Do you have any suggestions?
Thanx, Gianandrea
data(iris)
require(sqldf)
base<-sqldf("select * from iris where Species <> 'setosa'")
str(base) # Species with 3 levels!
--
View this message in context:
2010 Nov 01
1
sqldf error only on Unix not Windows
Hello Group,
I am having trouble with the sqldf package on unix. The same code works fine on windows.
Silly Example script:
# Load the package
library(sqldf)
# Use the titanic data set
data(women)
colnames(women)
head(women)
sqldf('select height, count(*) from women where height is not null group by weight')
Unix Output and error:
bash-3.00$ R --vanilla <testR.R
2017 Aug 11
0
Package sqldf in R and dates manipulation
See FAQ #4 on the sqldf github home page.
On Fri, Aug 11, 2017 at 9:21 AM, Mangalani Peter Makananisa
<pmakananisa at sars.gov.za> wrote:
> Dear all,
>
> I recently read the book " R data preperation and manipulation using sqldf package" by Djoni Darmawikarta
> However, I have a problem with manipulation of dates using this package, I do not get the expected results.
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be