Skip to main content

Load ODBC Data with R-Executor

Posted in

Hi everyone,

I'm trying to load ODBC data as a Dataframe, everything works fine within the R-Executor, but I can't get the data to connect the signals and work further.

library(RODBC)
conn <- odbcConnect("safira", uid="ripley", case="tolower")
dataS <- sqlQuery(conn, "select * from operacao_detail")

This is the code for the Dataframe creation. (sqlQuery returns a dataframe)

One more thing, in the youtube videos there's a manual data input. Seems that my version is lacking this widget.
My version is the 1.85B.

Congratulations, this project is promising.

Next phase...

Hello,
It was by chance that I discovered the need to SELECT the variable in the source and press the SEND button.

Since the R-Executor already display the "Available R Items", wouldn't be easier to append a radiobox (or select)at the side of the desired object and then SEND it?

Another question is: is there a control flow of scripts? Suppose many linked R objects and Scripts, in my case in particular I would need to REFRESH the database items, if I had the ability to "trigger" all the R objects in a coordinated mode would be just great.

I am a skilled Python programmer (more than 8 years) and I can help in my very limited spare time. Let me know if you need assistance. (to improve Docs would be a nice start).

That's it. Thanks.

Yes, you do have to select

Yes, you do have to select and send.

Not a bad suggestion for sending data. It would require a refresh of the list every time one made a new variable. R Executor is an "Advanced" widget made for people who want to have access to R. It's more utilitarian than anything else, made to give just enough functionality to execute R functions and put the data on the schema.

I'm not exactly sure what you are looking for with the REFRESH function. There is a function sendRefresh() and refresh() set of functions in the base widget class (https://red-r.org/devDoc/trunk/core/OWRpy.html) if you wanted to make a widget to use these things.

If you are running scripts that you use all the time and want to run them in an automated way then Red-R is a great choice. You'll just need to make a widget that does your script for you. I'd recommend going to options and setting your output preference to DEVEL and then duplicating one of the widgets to experiment with. One thing to watch out for is that the module name must be identical to the widget class name. You can also get the prototypes package from the repository and experiment by making changes to SandBox.py. Also take a look at the directory structure of any of the packages in the libraries directory of the Red-R install to get a feel for what you need to change and set (package.xml, meta/widgets/*.xml, ...)

We're trying to put together more in the way of developer and user documentation. We'd love any help you would be interested in giving. I think one of the main things that we need are widget functionality. If you have any experience with Qt, Qwt, or matplotlib I think there is a lot that could be done by linking up Python graphics with R. For developer documentation we're moving to a Sphinx system for the next version of Red-R. For user documentation, we're trying to put that together in a better way and should have much better documentation for the next release. If you have any questions about how to do something or if a tool exists please keep posting to this forum so other users can search for them.

Thanks for the input. Hope this helps. Please let me know if you have any more questions.
Kyle

Please check the class of

Please check the class of your object dataS using class(dataS) and see what it returns.

Or you can force this by using as.data.frame(dataS) and then sending all of that as a signal.

If class(dataS) does not return data.frame then it will be sent from the R object signal socket.

Thanks for the comment
Kyle