Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on R. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/r.e> # or at <http://angg.twu.net/e/r.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.R-debian» (to "R-debian") # «.R-sample» (to "R-sample") # «.pager» (to "pager") # «.ess» (to "ess") # «.marco_antonio» (to "marco_antonio") # «.slidify» (to "slidify") # «.sweave» (to "sweave") # «.swirl» (to "swirl") # «.rstudio» (to "rstudio") https://cran.r-project.org/ https://www.r-project.org/ https://en.wikipedia.org/wiki/R_(programming_language) ##### # # R on Debian # 2011nov21 # ##### # «R-debian» (to ".R-debian") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) apti r-base r-doc-info # (find-zsh "availabledebs | sort | grep r-base") # (find-zsh "grep-available r-base") # (find-zsh "grep-available 'Section: gnu-r'") # (find-status "r-base") # (find-vldifile "r-base.list") # (find-udfile "r-base/") # (find-status "r-base-core") # (find-vldifile "r-base-core.list") # (find-udfile "r-base-core/") # (find-status "r-base-html") # (find-vldifile "r-base-html.list") # (find-udfile "r-base-html/") # (find-status "r-base-latex") # (find-vldifile "r-base-latex.list") # (find-udfile "r-base-latex/") # (find-status "r-cran-boot") # (find-vldifile "r-cran-boot.list") # (find-udfile "r-cran-boot/") # (find-status "r-cran-cluster") # (find-vldifile "r-cran-cluster.list") # (find-udfile "r-cran-cluster/") # (find-status "r-cran-foreign") # (find-vldifile "r-cran-foreign.list") # (find-udfile "r-cran-foreign/") # (find-status "r-cran-kernsmooth") # (find-vldifile "r-cran-kernsmooth.list") # (find-udfile "r-cran-kernsmooth/") # (find-status "r-cran-lattice") # (find-vldifile "r-cran-lattice.list") # (find-udfile "r-cran-lattice/") # (find-status "r-cran-mgcv") # (find-vldifile "r-cran-mgcv.list") # (find-udfile "r-cran-mgcv/") # (find-status "r-cran-nlme") # (find-vldifile "r-cran-nlme.list") # (find-udfile "r-cran-nlme/") # (find-status "r-cran-rpart") # (find-vldifile "r-cran-rpart.list") # (find-udfile "r-cran-rpart/") # (find-status "r-cran-survival") # (find-vldifile "r-cran-survival.list") # (find-udfile "r-cran-survival/") # (find-status "r-cran-vr") # (find-vldifile "r-cran-vr.list") # (find-udfile "r-cran-vr/") # (find-status "r-doc-info") # (find-vldifile "r-doc-info.list") # (find-udfile "r-doc-info/") # (find-status "r-recommended") # (find-vldifile "r-recommended.list") # (find-udfile "r-recommended/") # (find-man "1 R") # (find-available "ess") # (find-node "(R-FAQ)Top") # (find-node "(R-admin)Top") # (find-node "(R-data)Top") # (find-node "(R-exts)Top") # (find-node "(R-intro)Top") # (find-node "(R-ints)Top") # (find-node "(R-lang)Top") ##### # # A sample session # 2011nov21 # ##### # «R-sample» (to ".R-sample") # (find-angg ".emacs" "R") # (find-node "(R-intro)A sample session") # (code-c-d "R" "/usr/lib/R/library/base/" "R-intro") # (find-Rfile "") # (find-Rfile "demo/") # (find-Rnode "") # (find-Rnode "A sample session") * (eepitch-R) * (eepitch-kill) * (eepitch-R) help() demo() x <- rnorm(50) y <- rnorm(x) plot(x, y) ls() rm(x, y) x <- 1:20 w <- 1 + sqrt(x)/2 dummy <- data.frame(x=x, y= x + rnorm(x)*w) dummy fm <- lm(y ~ x, data=dummy) summary(fm) fm1 <- lm(y ~ x, data=dummy, weight=1/w^2) summary(fm1) attach(dummy) lrf <- lowess(x, y) plot(x, y) lines(x, lrf$y) abline(0, 1, lty=3) abline(coef(fm)) abline(coef(fm1), col = "red") detach() plot(fitted(fm), resid(fm), xlab="Fitted values", ylab="Residuals", main="Residuals vs Fitted") qqnorm(resid(fm), main="Residuals Rankit Plot") rm(fm, fm1, lrf, x, dummy) filepath <- system.file("data", "morley.tab" , package="datasets") filepath file.show(filepath) mm <- read.table(filepath) mm mm$Expt <- factor(mm$Expt) mm$Run <- factor(mm$Run) attach(mm) plot(Expt, Speed, main="Speed of Light Data", xlab="Experiment No.") fm <- aov(Speed ~ Run + Expt, data=mm) summary(fm) fm0 <- update(fm, . ~ . - Run) anova(fm0, fm) detach() rm(fm, fm0) x <- seq(-pi, pi, len=50) y <- x f <- outer(x, y, function(x, y) cos(y)/(1 + x^2)) oldpar <- par(no.readonly = TRUE) par(pty="s") contour(x, y, f) contour(x, y, f, nlevels=15, add=TRUE) fa <- (f-t(f))/2 contour(x, y, fa, nlevels=15) par(oldpar) image(x, y, f) image(x, y, fa) objects(); rm(x, y, f, fa) th <- seq(-pi, pi, len=100) z <- exp(1i*th) par(pty="s") plot(z, type="l") w <- rnorm(100) + rnorm(100)*1i w <- ifelse(Mod(w) > 1, 1/w, w) plot(w, xlim=c(-1,1), ylim=c(-1,1), pch="+",xlab="x", ylab="y") lines(z) w <- sqrt(runif(100))*exp(2*pi*runif(100)*1i) plot(w, xlim=c(-1,1), ylim=c(-1,1), pch="+", xlab="x", ylab="y") lines(z) rm(th, w, z) q() n ##### # # The PAGER variable # 2011nov21 # ##### # «pager» (to ".pager") # (find-angg ".emacs" "R") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) PAGER=cat command R help() demo() * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) command R help() demo() ##### # # Ess (Emacs Speaks Statistics) # 2011nov21 # ##### # «ess» (to ".ess") # (find-status "ess") # (find-vldifile "ess.list") # (find-udfile "ess/") ##### # # Modelo 17 (by Marco Antonio da Cunha Ferreira) # 2012mar23 # ##### # «marco_antonio» (to ".marco_antonio") # (find-fline "~/usrc/Modelo017_Em_teste/") # (find-fline "~/usrc/Modelo017_Em_teste/000_Main.r") (code-c-d "modelo17" "~/usrc/Modelo017_Em_teste/") ;; (find-modelo17file "") ;; (find-modelo17file "000_Main.r") * (eepitch-R) * (eepitch-kill) * (eepitch-R) # (find-modelo17file "000_Main.r") setwd("~/usrc/Modelo017_Em_teste") source("000_Main.r") source("~/usrc/Modelo017_Em_teste/") ##### # # Slidify (announced on the Org list) # 2013jan23 # ##### # «slidify» (to ".slidify") # http://ramnathv.github.com/slidify/ ##### # # sweave # 2019mar22 # ##### # «sweave» (to ".sweave") # https://cran.r-project.org/web/packages/svSweave/index.html # https://cran.r-project.org/package=svSweave # https://cran.r-project.org/web/packages/svSweave/svSweave.pdf # http://www.sciviews.org/SciViews-R/ ##### # # swirl: Learn R, in R # 2019mar22 # ##### # «swirl» (to ".swirl") # https://cran.r-project.org/web/packages/swirl/index.html # https://cran.r-project.org/web/packages/swirl/swirl.pdf # https://swirlstats.com/ ##### # # R Studio # 2019mar22 # ##### # «rstudio» (to ".rstudio") # https://www.rstudio.com/products/rstudio/download/ Emacs Speaks Statistics - Introductions https://ess-intro.github.io/ https://github.com/ess-intro/ess-intro/wiki https://news.ycombinator.com/item?id=30230846 A Quick Introduction to R (github.com/karoliskoncevicius) https://rcst.github.io/rim/ https://news.ycombinator.com/item?id=30764505 One Year with R (github.com/reecegoding) https://stackoverflow.com/questions/15759117/what-exactly-is-copy-on-modify-semantics-in-r-and-where-is-the-canonical-source https://web.archive.org/web/20220529010807/https://www.crumplab.com/cognition/textbook/index.html https://github.com/flujoo/gm Create music with R. https://news.ycombinator.com/item?id=40919160 Show HN: Create Music with R (github.com/flujoo) # Local Variables: # coding: utf-8-unix # End: