Skip to content

Instantly share code, notes, and snippets.

Avatar

Russell Dinnage rdinnager

View GitHub Profile
@sebkopf
sebkopf / README.md
Last active Jan 16, 2022
wolfram alpha from R
View README.md

Wolfram Alpha API from R

The attached code file provides an easy basic interface to the Wolfram Alpha API. Inspired by the wolframalpha module available for Python.

source("wa_lib.R")

Initialize client

View ListToDf.md

Is there an easy way to convert a named list into a dataframe, preserving the elements of the list in a "list-column"?

library(dplyr)
library(magrittr)

## make a random matrix
rand_mat <- function() {
  Nrow <- sample(2:15,1)

Ncol <- sample(2:15,1)

@aammd
aammd / ListToDf.md
Last active Jan 5, 2021
turning a named list into a dataframe using dplyr
View ListToDf.md

Is there an easy way to convert a named list into a dataframe, preserving the elements of the list in a "list-column"?

    library(dplyr)
    library(magrittr)

    ## make a random matrix
    rand_mat <- function() {
@aammd
aammd / fizzbuzz.md
Last active Jan 25, 2017
An example of calculating "FizzBuzz" in R using dplyr and magrittr
View fizzbuzz.md

Apparently, there is a simple problem called Fizz buzz which is sometimes used to identify competent programmers. A good opportunity to practice some dplyr and magrittr tricks.

library(dplyr)
library(magrittr)
library(knitr)

1:100 %>%
 data.frame %&gt;%
View data.manipulation.md

Simple data manipulations in R

Many years ago, I was introduced to R by Cam Webb . At the time, his website contained a list of common data manipulations (original here). This list dated from Cam's early experience with R, and contained the R-help mailing list responses to a series of data manipulations. For a long time, I kept this file as a handy reference. I printed it out. I recommended it to friends.

Now I have been using R for years, and the state of the art has advanced considerably. Particulary, Hadley Wickham's reshape2 and dplyr packages have transformed the way most useRs manipulate their data. I decided that it would be interesting to revisit my favourite resource and try my hand at solving these problems with tools from these two packages.

library(reshape2)
library(dplyr)
@woobe
woobe / README.md
Last active Aug 29, 2015
[rblocks]: Experiments
View README.md

The rBlocks Experiement

Having fun with Ramnath Vaidyanathan's new package rblocks!

Iris & AirPassengers

iris

ap

View neo4R_example.R
# Requirements
#sudo apt-get install libcurl4-gnutls-dev # for RCurl on linux
#install.packages('RCurl')
#install.packages('RJSONIO')
library('RCurl')
library('RJSONIO')
query <- function(querystring) {
h = basicTextGatherer()