Sorry mistake from me. This was another problem in my mind , but with
RMySQL.
Christian
> library(RMySQL)
> library(sqldf)
> sqldf("Select * from mtcars")
Fehler in mysqlNewConnection(drv, ...) :
RS-DBI driver: (Failed to connect to database: Error: Access denied
for user 'user'@'localhost' (using password: NO)
)
Fehler in if (dbname == ":memory:") dbDisconnect(connection) else if
(!dbPreExists && :
Argument hat Länge 0
> detach("package:RMySQL")
> sqldf("Select * from mtcars")
mpg cyl disp hp drat wt qsec vs am gear carb
1 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
2 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
3 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
4 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
5 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
.....................
--- Begin Message ---
Maybe that's a "problem" with the RSQLite package , probably detaching
the package help.
detach("package:RSQLite")
HTH, Christian
trying to structure sql to merge two datasets. structure follows:
dbs.possible.combos (all possible combinations of dates and places)
Date Place
1/1/10 N-01
1/1/10 S-02
1/2/10 N-01
1/2/10 S-02
etc...
dbs.aggregate (the raw data aggregated by date and location)
Date Place Days
1/1/10 N-01 6
1/1/10 S-02 10
1/2/10 S-02 5
Trying to merge so I look-up the values for each possible combo
dbs.final <- sqldf("select dbs.possible.combos$Date,
dbs.possible.combos$Place, dbs.possible.combos$Days FROM dbs.possible.combos
LEFT JOIN dbs.aggregate ON (dbs.possible.combos$Place = dbs.aggregate$Place)
AND (dbs.possible.combos$Date = dbs.aggregate$Date)")
Resulting in:
Error in sqliteExecStatement(con, statement, bind.data) :
RS-DBI driver: (error in statement: near ".": syntax error)
What am I getting wrong in the syntax?
--- End Message ---
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.