Holcombe:ProgrammingInR: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Template:Holcombe}}
{{Template:Holcombe}}
R is an interactive programming language for statistics. The syntax is very idiosyncratic, try [http://www.johndcook.com/R_language_for_programmers.html R for programmers] for a description.
R is an interactive programming language for statistics. The syntax is very idiosyncratic, and not really in a good way. Try [http://www.johndcook.com/R_language_for_programmers.html R for programmers] for a description.
However it may have menu-driven versions maybe available  
However it may have menu-driven versions maybe available  
[http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/ R commander] we haven't tried that and another one is pmg GTK [http://www.ggobi.org/rgtk2 maybe here]
[http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/ R commander] we haven't tried that and another one is pmg GTK [http://www.ggobi.org/rgtk2 maybe here]


[[R_Statistics]] introduces you to R
In the lab we have the book ''Using R for Introductory Statistics''. [[R_Statistics]] introduces you to R


[http://www.rpad.org/Rpad/R-refcard.pdf R reference cheatsheet], also
[http://www.rpad.org/Rpad/R-refcard.pdf R reference cheatsheet], also
Line 10: Line 10:
[http://www.statmethods.net/advgraphs/axes.html plot parameters]
[http://www.statmethods.net/advgraphs/axes.html plot parameters]


In the lab we have the book ''Using R for Introductory Statistics''.
There is a wiki with some good tips [http://wiki.r-project.org/rwiki/doku.php?id=start here]. Also
[http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames Data frame tips]


There is a wiki with some good tips [http://wiki.r-project.org/rwiki/doku.php?id=start here].
Functions in R can only return one parameter. Calling typeof() on a dataframe returns "list"!
[http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames Data frame tips]


Examining your data matrix or object, let's say it's called ''datos''
Examining your data matrix or object, let's say it's called ''datos''

Revision as of 15:19, 11 November 2009

Recent members

Alex Holcombe
• Ryo Nakayama



Technical

Skills Checklist
Python Programming
Psychopy/VisionEgg Installation Notes
R analysis,plot,stats
Statistics
Buttonbox
Buttonbox with photocell
Programming Cheat Sheets


R is an interactive programming language for statistics. The syntax is very idiosyncratic, and not really in a good way. Try R for programmers for a description. However it may have menu-driven versions maybe available R commander we haven't tried that and another one is pmg GTK maybe here

In the lab we have the book Using R for Introductory Statistics. R_Statistics introduces you to R

R reference cheatsheet, also a file here Media:Matlab-python-xref.pdf‎ that gives equivalent code for doing array operations in MATLAB, Python, and R plot parameters

There is a wiki with some good tips here. Also Data frame tips

Functions in R can only return one parameter. Calling typeof() on a dataframe returns "list"!

Examining your data matrix or object, let's say it's called datos

head(datos)
str(datos)

Don't use the function attach. It seems to leave lots of data in the 'environment' that can cause problems later. Also it makes the code harder to understand.

doing ANOVAs etc

some aov (ANOVA) explanation

R will assume factor is regressor if numeric

I think I had too many error terms reducing error terms

Dealing with circular data

von Mises vs. wrapped Gaussian,

see Swindale, N. V. (1998). Orientation tuning curves: empirical description and estimation of parameters. Biol Cybern, 78(1), 45-56.

Setting up a proxy in R on a Mac

The easiest way to set up a proxy is simply to create a file called ".Rprofile" in your user directory (~ or Users/username/) with the line:

 Sys.setenv(http_proxy=”http://username:password@tcdproxy.tcd.ie:8080″)

Then restart R. This information (and more) can be found on Ken Benoit's webpage

For Sydney Uni, use:

 Sys.setenv(http_proxy=”http://www-cache.usyd.edu.au:8080″)