I've successfully generated association rules using the R arules library.
What I'd like to do now is the equivalent of a prediction join in DMX. I want to take an item, and get the top 5 relevant items back.
I see the predict method in the arules library, but the documentation doesn't indicate that it is used for this type of prediction.
Taking it a step further, how do I reuse the rules I've created in a script of some sort? Should I export them to a file and import them directly every time I want to generate related items?
I'm coming from the Microsoft Data Mining world, where a model persists on a server. I'm not even sure if what I'm asking is the appropriate way to do it using R. Thanks for any guidance.
Related
I am using Biblioshiny for Bibliometric analysis. As I am quite new to R, and would like to learn more about the underlaying code used by biblioshiny; I was wondering if it is possible to see the resulting R-code generated through the options configured in the web interface in biblishiny. E.g. when creating a ci-citation network in Biblioshiny, can I see the actual executed R-code used to generate this network?
Recently. I though perhaps one can enable a debug-mode and/or see the code through some logs. I do not know if this is the case, or if better solutions exists.
I know that exported data (access to users) belongs in the data/ folder and that internal data (data used internally by package functions) belongs in R/sysdata.rda. However, what about data I wish to both export to the user AND be available internally for use by package functions?
Currently, presumably due to the order in which objects/data are added to the NAMESPACE, my exported data is not available during devtools::check() and I am getting a NOTE: no visible binding for global variable 'data_x'.
There are probably a half dozen ways to get around this issue, many of which appear to me as rather hacky, so I was wondering if there was a "correct" way to have BOTH external and internal data (and avoid the NOTE from R CMD check).
So far I see these options:
write an internal function that calls the data and use that everywhere internally
Use the ':::' to access the data; which seems odd and invokes a different warning
Have a copy of data_x in BOTH data/ and R/sysdata.rda (super hacky)
Get over it and ignore the NOTE
Any suggestions greatly appreciated,
Thx.
I am trying to use RSiena Test's sienaDataCreateFromSession() function to create a network object from an edge list. However, the available documentation for the function does not provide any instruction how to do so: https://www.rdocumentation.org/packages/RSiena/versions/1.1-232/topics/sienaDataCreateFromSession
I would be grateful for any advice and example how to do so.
While the function mentioned, sienaDataCreateFromSession(), is still available in the {RSienaTest} package from R-Forge, it is effectively obsolete.
Users are recommended to instead import data into their R session in whatever form they have it in, and then wrangle it into the correct shape for sienaDataCreate() and sienaDependent() as outlined in the manual.
If there is continued need for additional helper functions in the main package, please raise this as an issue on the RSiena Github page.
When I look at documentation for R packages, it often comes in a PDF document like this:
https://cran.r-project.org/web/packages/glmnet/glmnet.pdf
Does that document have a name?
Normally I find these documents by searching on the web, but I wonder if I can also produce them using some R command like library(help=...) or vignette(...). However, this answer makes it sound somewhat complicated, like I have to compile the package myself and run R CMD Rd2pdf, is that correct?
Also, as a prospective package author, I could imagine having this PDF document serve as the primary documentation for my package. The only obstacle is that when I read these documents, the documented functions always seem to appear in alphabetical order. Is there a way to put the most important functions first, so that the document can be read straight through (rather than just as a reference)? Or is there another documentation format which will let me document things in a certain order?
The reference manual is just a collection of the help pages. They should be written as reference material, which is probably not the first place a user should look for documentation, if that's what you mean by "primary documentation".
The first place users should look is for a vignette which provides an overview of the package. It can be displayed in HTML or PDF (it's up to the package author to choose). Since it is free-form, you can document things in a logical order, you aren't restricted to the alphabetical order of the reference manual.
It's also optional, and I use it as a measure of quality of a package that I'm investigating: if they don't have such a vignette, the authors don't really care about providing good documentation.
For example, I see the XTS object created using a package of same name. If I wanted to create for example a class of "Interest Rate Swap", would that be possible? How? I found an example using lambd.r here http://www.r-bloggers.com/pricing-interest-rate-swaps-with-lambda-r/ however that seems having to leverage functional programming. I searched for "constructor" in the R-Book, but nothing there.
You can use the setClass method. It, and the parameters, are described pretty well here:
Site to Create an Object Class
It allows you to set all of the parameters you would want to use to define a class and create objects for a package (like a SpatialPolygon from Leaflet). You can start with the basics found there, but you will likely want to read one of the books on creating packages if you intend to create a series of intertwined methods to work on a specific class of object you create.