You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
I would like to use monetDB lite as an alternative to SAS for my medium data problems. To that end I need to add new columns consisting of transformations of existing columns done in R. I have searched the internet and documentation for a solution to this and have not found an answer.
To update the new column I have tried using databinding, but it seems this only works for one value:
## ?? how to populate new column from R?insert<- dbSendQuery(con, 'PREPARE INSERT INTO mtcars (mpg_per_cyl) VALUES (?)')
> dbBind(insert, list(mpg_per_cyl=mtcars$mpg/mtcars$cyl))
Errorin vapply(params, function(x) { :valuesmustbelength1,
but FUN(X[[1]]) resultislength32Inaddition:Warningmessage:Inif (is.na(x)) "NULL"elseif (is.numeric(x) || is.logical(x)) { :theconditionhaslength>1andonlythefirstelementwillbeused
The documentation for dbSendUpdate has the only reference to placeholders in the MonetDBLite package I could find. I am a bit new to working with DBs so forgive me if I've overlooked something obvious. Does this capability already exist?
The text was updated successfully, but these errors were encountered:
After adding the column using ALTER TABLE you can of course do something like dbExecute(con, "UPDATE mtcars SET mpg_per_cyl=mpg/cyl"). But if I understand you correctly that value is computed by R? So what you would like to do is to extend your table with an R-computed column?
Yes, precisely! I would like to do some computations in R and then either add or update a column using the R vector. I've seen examples that do this by using paste to effectively update row by row, but the column-store nature of MonetDB seems better suited to this model. I hope there is an idiomatic way to accomplish this. This is a fairly common use case for my group where our data is larger than memory but not larger than HDD.
I would like to use monetDB lite as an alternative to SAS for my medium data problems. To that end I need to add new columns consisting of transformations of existing columns done in R. I have searched the internet and documentation for a solution to this and have not found an answer.
I would like to do something like this:
To update the new column I have tried using databinding, but it seems this only works for one value:
The documentation for dbSendUpdate has the only reference to placeholders in the
MonetDBLite
package I could find. I am a bit new to working with DBs so forgive me if I've overlooked something obvious. Does this capability already exist?The text was updated successfully, but these errors were encountered: