The post from Adventures in Analytics and Visualization uses ggplot2, rCharts, googleVis, and the shiny server.
[ and [[ are a little bit faster (~15%) in the case below:
prefix <- sample(LETTERS, size=100, replace=TRUE)
paste(prefix, abs(100 * rnorm(100)), sep="-")
benchmark(sapply(strsplit(id, "-"), function(a) a), sapply(strsplit(id, "-"), "[", 1), order="elapsed", replications=100)
Did you know you can use
"[[" as function names for subsetting with calls to the
For example, suppose you have a bunch of identifier strings like
"ZYY-43S-CWA3" and you want to pull off the bit before the first hyphen (
"ZYY" in this case). (For code to create random IDs like that, see the end of this post.)
Suppose the IDs are in a vector of character strings,
If I wanted to grab the bit before the first hyphen, I would typically use
strsplit and then
function(a) a, as so:
But in place of
function(a) a, you can use
"[", 1, as follows:
I think that’s kind of cute. You can use
"[[" the same way, if you’re working with lists.
Here’s some code to create random IDs of this form, to test out the above:
In brief, Free the memory by
rm(), and then do garbage collection by
(The page is still under construction.)
Complex network analysis is quite common in biology and social network analysis. However, CRAN task views don’t provide a specific section. Here, I collect R packages for complex network analysis.
iGraph: generic purpose
iGraph is a C library for manipulating graphs, complex network analysis, social network analysis. It has R and Python interfaces. My own experience is that it runs really fast.
- Homepage, doc, C library doc (more task orientated)
- Community detection
- What is the difference between these algorithms?