Sources on S4 objects, methods and programming in R [closed] - r

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
As I'm often confronted with situations where S4 programming is needed to keep an overview, I've collected quite some sources on S4 objects, methods and programming. I've listed them here as a reference. Please add your own sources as well.
On the web
The methods help files : help files from the package methods, where much of the necessary information can be found
S4 classes in 15 pages : Short introduction on the programming with S4 objects.
How S4 methods work : more explanation about the underlying mechanisms.
Not so short introduction to S4 : with practical examples of how to construct the classes and some useful tips. It contains a handy overview as appendix, but contains errors as well. Care should be taken using this one.
OOP in R : handout notes with practical examples on S3 and S4
S4 Objects : presentation by Thomas Lumley about S4 objects.
R object oriented programming : in-depth introduction to object oriented programming in R. It covers S3, S4 and S4 reference classes. The accompanying sequences package implements the class system used throughout the slides.
Books
Software for Data Analysis-Programming with R (J. Chambers) : A classic, although not reviewed positive everywhere, that contains a large section on S4
R programming for Bioinformatics (R. Gentleman) : specifically directed towards working with Bioconductor, which is completely based on S4. But it gives a broad overview and is useful for many other people too.
PS : if somebody finds the community checkbox, you can make this a community-owned post. Somehow I can't find it in the edit window any more...

My write up of S4 (still in progress) is available here: http://adv-r.had.co.nz/S4.html

R for programmers (Matloff) (free) and Introduction to scientific programming and simulation (Jones) have a short section on "new-style" S4 classes.

Another good book by John Chambers: "Programming with Data: A Guide to the S Language". As the name suggests it is actually about S, not R, but it provides a lot of valuable information about S4 classes anyway.
There's also some information in the R manuals "Writing R Extensions" and "R Internals" (particularly the latter). Those can be found at http://cran.r-project.org/doc/manuals/.
Finally, I would recommend "How S4 Methods Work", which is a great overview of how to think about S4 as it fits into R.

Related

Is there a package in R for statistical relational learning [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I just searched on google and r-project.org but couldn't find anything.
Is there a package in R for statistical relational learning?
Link to wikipedia:
http://en.wikipedia.org/wiki/Statistical_relational_learning
Yes, there are quite a few actually.
On CRAN, look at the gRaphical Models Task View.
Under each header is a listing of R Packages subsumed under that subject header--the first being Representation, manipulation and display of graphs.
Scroll down this page to the last three section headers:
Miscellaneous: Model search, specialized types of models etc.,
Bayesian Networks/Probabilistic expert systems; and
BUGS models, just below it.
Under these three headers are a total of 16 R Packages (seven, three and six packages, respectively). Within these nine, you should have no trouble finding a couple most suited for your project.
The only one I have personally used is bnlearn, a Package for Bayesian network structure learning. This is not my field, so I recall that the Package documentation (Manual and Vignette) are excellent and include working code examples.
Finally, for visualizing these models, I recommend highly the R bindings to the excellent Graphviz Library; the R bindings are gathered in the R Package, RGraphviz. RGraphviz is not available on CRAN but rather on Bioconductor; it depends on GraphViz.
Not yet, actually. Doug's answer is inherently misleading. If someone's looking for non-R implementation of the requested models, I may provide this link.

Is there any Genetic Programming code written R [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm interesting in evolutionary algorithms. I have tested genetic algorithms with R but has someone tried with genetic programming? Do you know, if there are code somewhere written in R.
I'm not aware of anything on CRAN for genetic programming in particular, although there is some work being done on the problem. In particular, have a look at the RGP package that is still in development.
Otherwise, have a look at the RFreak package, which is a wrapper for the "Free Evolutionary Algorithm Kit".
You might want to have a look at genalg, at GA and at galgo
There is a new package available:gramEvol: Grammatical Evolution for R
A native R implementation of grammatical evolution (GE). GE
facilitates the discovery of programs that can achieve a desired goal.
This is done by performing an evolutionary optimisation over a
population of R expressions generated via a user-defined context-free
grammar (CFG) and cost function.
You can find the vignette here:Grammatical Evolution: A Tutorial using gramEvol
UPDATE: I posted an article on my blog about it:
Symbolic Regression, Genetic Programming… or if Kepler had R.

Kohonen SOM Maps in R Tutorial [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am simply looking for a good tutorial that will walk me through how to create a SOM in R. I am reading Kohonen and Kaski's paper on using the maps to identify the structure of Welfare, and want to try the technique my self.
I think many of the examples in R have a lot to be desired. I have looked on the web and didn't find anything that I thought made the process easy to understand.
Any help you can provide will be greatly appreciated.
A few pointers:
SOM package
Kohonen package
Most of the SOM related packages are from the Chemometrics and Computational Physics area, but you also have a look at the cluster view on CRAN.
Edit: Incidentally, I'm not aware of any tutorials, but one good way to find examples is to google with ext:r. There are several "som" scripts that show up that way, including this example which shows how to use it with GGobi.
Shane already mentioned the kohonen package. An introduction and tutorial can be found in the Journal of Statistical Software:
Self- and Super-organizing Maps in R: The kohonen Package
Did you look at the CRAN package SOM ?
GeoSpatial Data Mining course from edugi has pretty good materials.

Asynchronous network IO using r: Any existing packages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Are there any R-project packages that facilitate asynchronous network IO?
I'm think here along the lines of Ruby's Eventmachine or Python's Twisted.
If there are several such packages/libraries which is the best in terms of:
- performance
- features
First of all, R is single-threaded, so typically people try to use parallel computing approaches (see, for instance, the snow package). I don't think there's anything quite like Eventmachine or Twisted.
Check out the following:
The "State of the Art in Parallel Computing with R" paper describes most of the approaches to parallel computing in R (http://www.jstatsoft.org/v31/i01/paper). There are many useful packages in the HighPerformanceComputing view: http://cran.r-project.org/web/views/HighPerformanceComputing.html.
Check out svSocket: http://cran.r-project.org/web/packages/svSocket/
You can try using NetWorkSpaces with R: http://cran.r-project.org/web/packages/nws/.
There are several examples of R servers. RServe: http://www.rforge.net/Rserve/
The iBrokers packages is one of the only ones that I know which uses asynchonous requests. Have a look at the source code for that package (you can download it off R-Forge) and the related vignette: http://cran.r-project.org/web/packages/IBrokers/vignettes/RealTime.pdf
The biocep project also includes many relevant features: http://biocep-distrib.r-forge.r-project.org/

How to learn R as a programming language [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'd like to know how to learn the R language as as 'programming' language as opposed to learning it as a statistical system. My question is prompted by lack of understanding of such functions as parse, eval, etc. which may not find frequent use by an R user with a 'statistics' persuasion.
Edit: I've been exploring such tools like Rpy RSPerl rJava and wish to (at the very least) be able to understand concepts that facilitate R's communication with other programming languages.
The availability of Web applications for R (R-PHP, RApache, etc.) is another motivationg factor for me to gain a deeper, more structural understanding of R.
Last but not the least, I'd like to be able to write R packages for which such understanding would be beneficial if not necessary.
For starters, you might want to look at this article by John Cook. Also make sure that you read "The R Inferno".
There are many good resources on the R homepage, but in particular, read "An Introduction to R" and "The R Language Definition".
Some very closely related stackoverflow questions:
books-for-learning-the-r-language.
what-are-some-good-books-web-resources-and-projects-for-learning-r
suggestions-on-way-resources-to-start-learning-statistical-language-r
My favorite book on the subject: "Software for Data Analysis: Programming with R", by John Chambers, the creator of the S language.
(source: springer.com)
A good book for learning R-as-a-programming-language (as opposed to R-for-statistics) is The Art of R Programming, by Norman Matloff.
It's very readable, doesn't assume you're a computer scientist, and is quite inexpensive as R books go.
I would rather suggest a good and comprehensive start, like The R Book by Michael Crawley. It's an easy-to-read and complete book on R core functions, with statistical tips and a few exercises. It focuses a lot on R strengths (e.g. linear models) and gives also useful coding tricks. It helped me a lot while I was struggling on cryptic online courses.
I'm a very hands-on learner, so this advice may be specific to my learning style. I would suggest that the best place to start "learning to program" in any language involves finding problems outside of your normal range of experience and then trying to solve them using a programming language.
The projects that taught me the most about how to program with R had nothing to do with statistics at all.
Knowing functions like parse() and eval() is by no means a measure for being "a good R programmer". Applications that require heavy use of these functions do not make up a majority of the problem space in which you can apply R. Instead, I think you should try to be "a good programmer" who knows R. This involves refining your problem-solving approaches.
Programming is not a spectator sport-- a good book is indispensable as a reference on the tools available, but you need to find some problems upon which to hone your skills.

Resources