Skip to content

Instantly share code, notes, and snippets.

@shabbychef
Created December 12, 2012 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shabbychef/4271636 to your computer and use it in GitHub Desktop.
Save shabbychef/4271636 to your computer and use it in GitHub Desktop.
demonstrate R and octave 'magics' in ipython.
# to get the R<->python magic
%load_ext rmagic
# now you can code in R:
%%R
library(survival)
amod <- coxph(Surv(lung$time,lung$status) ~ lung$sex + lung$ph.karno)
print(summary(amod))
# done
# to get the octave<->python magic
%load_ext octavemagic
%%octave
x = randn(100,20)
y = sum(x,1)
# done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment