Skip to content

Instantly share code, notes, and snippets.

View casallas's full-sized avatar

Juan Sebastián Casallas casallas

  • Iowa State University, Arts et Métiers ParisTech
  • Chalon-sur-Saône, France
View GitHub Profile
@casallas
casallas / ezpolar_ggplot2.md
Last active August 29, 2015 14:07
ezpolar in ggplot2

Mimicing Matlab's ezpolar in R, with ggplot2

In MATLAB/octave plotting stuff in polar coordinates is really easy, e.g. the cardioid $r(\theta) = 1+cos(\theta)$, $0 < \theta < 2\pi$ is as simple as:

ezpolar('1+cos(t)',[0,2*pi])

In ggplot, more verbose is needed

@casallas
casallas / check.packages.R
Created July 23, 2014 05:14
Check installed R packages
res <- apply(installed.packages(), 1, function(ip){require(package=ip["Package"], lib.loc=ip["LibPath"], character.only=T)})
res[res==F]
@casallas
casallas / wilcox_nont.r
Created May 18, 2014 09:20
Non-transitive dice and the wilcoxon test
# Based on http://notstatschat.tumblr.com/post/63237480043/rock-paper-scissors-wilcoxon-test
d1 <- c(4, 4, 4, 4, 0, 0)
d2 <- c(3, 3, 3, 3, 3, 3)
d3 <- c(6, 6, 2, 2, 2, 2)
d4 <- c(5, 5, 5, 1, 1, 1)
wilcox.test(d1, d2, alternative="greater")
wilcox.test(d2, d3, alternative="greater")
wilcox.test(d3, d4, alternative="greater")
wilcox.test(d4, d1, alternative="greater")
@casallas
casallas / knitr-include-child.Rnw
Created May 13, 2014 23:30
knitr include (not input) child
This chunk below is from the child document.
<<set-parent, echo=FALSE, cache=FALSE>>=
if(!exists("master_mode")) master_mode <- F
if(!master_mode)
knitr::set_parent('knitr-include.Rnw')
@
<<test-child, out.width='2in', fig.show='asis'>>=
1+1
@casallas
casallas / svn2git.md
Last active August 29, 2015 13:56
Using svn2git
  1. Get authors:

svn log --quiet http://path/to/root/of/project | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/^ //' | sort | uniq

  1. Make an authors.txt file containing, e.g.,
author = Name LastName <auth@mail.com>
author2 = Name2 LastName2 <auth2@mail.com>
@casallas
casallas / ng_lmm.md
Last active January 4, 2016 02:59
(non | generalized) linear mixed-effects models (or multi-level [non | generalized] linear models), and ANOVA
@casallas
casallas / osx_mod.md
Created January 18, 2014 19:56
OS-X Modifications

Mavericks

gnutar

gnutar is no longer shipped with Mavericks, this may cause some issues, e.g. when running R devtools.Solution, based on this blogpost:

brew install gnu-tar
cd /usr/bin
sudo ln -s  `brew --prefix gnu-tar`/libexec/gnubin/tar /usr/bin/gnutar
@casallas
casallas / rjags_mac.md
Last active January 31, 2024 23:16
Installing rjags on a Mac

To install

  1. Install jags: in the terminal using homebrew brew install jags
  2. Install rjags: in R
install.packages("rjags")
library(rjags)

Potential issues

@casallas
casallas / pooling.md
Created January 11, 2014 21:00
Pooling/no. pooling
@casallas
casallas / read_writing_res.md
Last active May 5, 2023 17:22
Reading/Writing resources

Writing

Jones, Simon. How to write a great research paper: Seven simple suggestions. Great talk, mostly focused on CS, but applicable in other disciplines. https://www.youtube.com/watch?v=g3dkRsTqdDA

Goodson, Patricia. "Becoming an Academic Writer 50 Exercises for Paced, Productive, and Powerful Writing". General (e.g. get in the habit of writing) and concrete (i.e. per section) exercises to become a better writer. Additional book resources (writing log, article template). http://www.sagepub.com/goodson/study/resources.htm

Silvia, Paul. "How to write a lot"

Strunk, William. Elements of Style. Ithaca, N.Y.: Priv. print. [Geneva, N.Y.: Press of W.P. Humphrey], 1918; Bartleby.com, 1999. www.bartleby.com/141/. [Date of Printout].