Displaying 20 results from an estimated 10000 matches similar to: "Creating a data table (frame?) from a SQL Statement?"
2017 Oct 25
2
How to create a table structure in Java code?
Hi all,
Using RConsole, it's easy to get data from the database that you can use in an R Command. Like this:
(Reference case)
irisQuery <- dbGetQuery(conn, "select * from iris")
boxM(irisQuery [,-5], irisQuery[,5])
----
(Actual case this posting is about)
Yet, if I'm getting that same (sample IRIS) data, say, in a web service possibly POSTED from a SQL command, that same
2017 Oct 24
0
Creating a data table (frame?) from a SQL Statement?
Please always cc the list... the group usually has better answers than any one person, and I don't do private consulting on the net. For future reference, there is also an r-sig-db mailing list where this question really belongs.
Since I almost never use jdbc, I would need a reprex (hint you are ignoring my advice... a good way to get ignored), which this still isn't. There is probably
2017 Oct 26
3
How to create a table structure in Java code?
That's amazing! Thank you!!!
One follow up question, if that's OK?
If, instead of using hard-coded CSV, I read the CSV into a variable first, then it fails again with a parse error.
Code below.
So, if I read the CSV into a variable, do I need an additional wrapper method?
Seems like it should still work.
Thanks in advance for your reply.
-M
String inputIris =
2017 Oct 26
1
How to create a table structure in Java code?
Thanks! I just figured it out (thanks to "Beyond Compare") and was coming here to post back.
The boxM test doesn't work with that (now, finally working) REXP structure, but I probably now need to create a table or something and parse that structure.
So much fun! :)
Thanks again.
- M
Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.
> --------
2017 Oct 26
0
How to create a table structure in Java code?
I suspect that you are looking for something like:
read.csv(textConnection(
"5.1,3.5,1.4,0.2,setosa
4.9,3,1.4,0.2,setosa
4.7,3.2,1.3,0.2,setosa
4.6,3.1,1.5,0.2,setosa
5,3.6,1.4,0.2,setosa"
), header = FALSE)
HTH,
Jan
On 25-10-17 12:50, Morkus via R-devel wrote:
> Hi all,
>
> Using RConsole, it's easy to get data from the database that you can use in an R Command. Like
2017 Oct 26
0
How to create a table structure in Java code?
You are entering the quoting hell - you are missing quotes and escapes for \n. it would be much more reasonable to use the rConnection.assign method instead of pasting any content through the parser.
Cheers,
Simon
> On Oct 26, 2017, at 9:59 AM, Morkus via R-devel <r-devel at r-project.org> wrote:
>
> That's amazing! Thank you!!!
>
> One follow up question, if
2017 Oct 28
2
Cannot Compute Box's M (Three Days Trying...)
Thanks Duncan. Awesome ideas!
I think we're getting closer!
I tried what you suggested and got a possibly better error...
.
.
.
rConnection.assign("boxMVariable", myDf);
String resultBV = "str(boxMVariable)"; // your suggestion.
RESULTING ERROR:
Error in format.default(nam.ob, width = max(ncn), justify = "left") : invalid 'width' argument
(No idea
2017 Oct 28
2
Cannot Compute Box's M (Three Days Trying...)
Hey Duncan,
Hard to debug? That's an understatement. Eyes bleeding....
In any case, I tried all your suggestions. To get "integer" for the final column, I had to change the code to get integers instead of strings.
double[] d1 = ((REXPVector) ((RList) tableRead).get(0)).asDoubles();
double[] d2 = ((REXPVector) ((RList) tableRead).get(1)).asDoubles();
double[] d3 = ((REXPVector)
2017 Oct 29
2
Cannot Compute Box's M (Three Days Trying...)
Thanks Duncan. I can't tell you how helpful all your terrific replies have been.
I think the biggest surprise is that nobody appears to be using Java and R together like I"m trying to do. I suppose it should be a surprise since there are no books on the subject and almost no technical documentation other than a few sites here and there.
-----
I originally had the "int" as the
2017 Oct 28
2
Cannot Compute Box's M (Three Days Trying...)
I'm not sure what you mean. Could you please be more specific?
If I print the string, I get: boxM(boxMVariable[, -5], boxMVariable[, 5])
From this code:
.
.
.
// assign the data to a variable.rConnection.assign("boxMVariable", myDf);
// create a string command with that variable name.String boxVariable = "boxM(boxMVariable[, -5], boxMVariable[, 5])";
2017 Oct 29
3
Renjin?
Hi All,
OK, in the "back to the drawing board" department, I found what looks like a much better solution to using R in Java. Renjin.
Looking at the docs and then trying a quick example, didn't quite work.
Of course I'm missing something.
Although I'm telling the engine to require ("biotools") just like I would in R itself, when I get to the line of code that
2017 Oct 28
0
Cannot Compute Box's M (Three Days Trying...)
On 28/10/2017 7:12 AM, Morkus wrote:
> Thanks Duncan. Awesome ideas!
>
> I think we're getting closer!
>
> I tried what you suggested and got a possibly better error...
> .
> .
> .
> rConnection.assign("boxMVariable", myDf);
>
> *String resultBV *= *"str(boxMVariable)"*; *// your suggestion.*
>
> *RESULTING ERROR:*
>
>
2017 Oct 28
0
Cannot Compute Box's M (Three Days Trying...)
On 28/10/2017 8:59 AM, Morkus wrote:
> Hey Duncan,
>
> Hard to debug? That's an understatement. Eyes bleeding....
>
> In any case, I tried all your suggestions. To get "integer" for the
> final column, I had to change the code to get integers instead of strings.
The last column in iris is actually a factor. That's stored as an
S3-classed integer vector
2013 Jul 15
2
Serialize data.frame to database
Dear R-Users,
I need a very fast and reliable database solution so I try to serialize a data.frame (to binary data) and to store this data to an SQLite database.
This is what I tried to do:
library(RSQLite)
con <- dbDriver("SQLite")
db <- dbConnect(con, "test")
dbSendQuery(db, 'CREATE TABLE frames("simID" INT, "data" BLOB)')
data.bin <-
2017 Oct 27
4
Cannot Compute Box's M (Three Days Trying...)
It can't be this hard, right? I really need a shove in the right direction here. Been spinning wheels for three days. Cannot get past the errors.
I'm doing something wrong, obviously, since I can easily compute the Box's M right there in RStudio
But I don't see what is wrong below with the coding equivalent.
The entire code snippet is below. The code fails below on the call to
2017 Oct 29
0
Cannot Compute Box's M (Three Days Trying...)
On 29/10/2017 7:26 AM, Morkus wrote:
> Thanks Duncan. I can't tell you how helpful all your terrific replies
> have been.
>
> I think the biggest surprise is that nobody appears to be using Java and
> R together like I"m trying to do. I suppose it should be a surprise
> since there are no books on the subject and almost no technical
> documentation other than a
2017 Oct 29
1
Cannot Compute Box's M (Three Days Trying...)
Hey Duncan,
Since Java is the #1 language and R is extremely popular, I think the most telling thing is that nobody on the "R-devel" forum (where people do "programming with R") is doing R and Java like I'm doing: calling R from Java and passing data structures.
So it appears I'm clearly pushing R somewhere it doesn't want to go. And, the boxM issue is more or
2017 Oct 27
2
How to do a "Box's M" Test with
Trying to get past a frustrating error to do a "simple" Box's M test using Java.
The Box's M test says it will work with a data.frame.
Here's the setup code:
REXP myDf = REXP.createDataFrame(new RList(
new REXP[]
{
new REXPDouble(d1),
new REXPDouble(d2),
new REXPDouble(d3),
new REXPDouble(d4),
new REXPInteger(d5)
}));
Here's the call:
REXP boxMResult =
2019 Jan 21
1
Request: make `var` a generic
Hi all,
I am running into problems using `summary.lm` as calling `var` on a `units`
object does not retain the `units` attribute.
The units package addresses this issue for `mean` by implementing
`mean.units`:
units:::mean.units
function (x, ...)
{
.as.units(NextMethod(), units(x))
}
This is, however, not possible for `var` (as it's not a generic), which
breaks `summary.lm`:
```
2008 May 12
1
Insert a recorde into a table using SQL
Dear list,
I want to insert a recorde into a SQLite table by dbGetQuery(), but
there is a problem when the value contains quotation mark.
> dd<-data.frame(txt=c("having both ' and \" in character.","OK"))
> library(RSQLite)
Loading required package: DBI
> con<-dbConnect(dbDriver("SQLite"),":memory:")
>