From OpenWetWare

(Difference between revisions)
Jump to: navigation, search
(Debugging in R)
m (Setting up a proxy in R on a Mac: fixed up the manual proxy address given)
Line 110: Line 110:
For Sydney Uni, use:
For Sydney Uni, use:

Revision as of 19:36, 1 December 2010


Alex Holcombe
Sarah McIntyre
Fahed Jbarah
• Shih-Yu Lo
• Patrick Goodbourn
Lizzy Nguyen


Skills Checklist
Python Programming
Psychopy/VisionEgg Installation Notes
R analysis,plot,stats
Verifying timing
Programming Cheat Sheets






Functions in R can only return one parameter.

dataframe stuff

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

typeof(datos) #returns "list!"
str(datos) #tells you it's a dataframe, number of observations, columns, etc
summary(datos) #good for ggplot objects also
df$varWithExtraLevels = factor(df$varWithExtraLevels)
length(df) #number of columns of dataframe
names(df) #names of columns of dataframe
#Calling typeof() on a dataframe returns "list"
rm(list = ls())  #Delete nearly everything in memory

expand.grid() to create dataframe with every combination of some factors

Check your counterbalancing in your results file. Make a contingency table,


Creating Graphs (usu. ggplot2)

Good advice on graph choice, from human perceptual standpoint by Frank Harrell



ggplot2 tips:

#where 'g' is your ggplot object
str(g)  #gives you everything!
summary(g) #gives a summary
last_plot() #refreshes the last plot and returns the struct
p=p+scale_y_continuous(breaks=c(0,0.5,1),minor_breaks=c(.25,.75)) #changing axis breaks
p=p+opts(title="one-behind errors")
p=p+xlab('relative phase')
opts(panel.grid.minor = theme_blank())+
last_plot() + opts(panel.grid.minor = theme_line(colour = "black") )
facet_grid(.~subject)  # rows~columns
g<-g+stat_summary(fun.y=mean,geom="point",position="jitter") #getting jitter to work when you're collapsing across other variables with stat_summary
g=g+ stat_smooth(method="glm",family="binomial",fullrange=TRUE) #adds logistic smoother to plot
#it's impossible to extract the function fits however because they're fit on the fly
#how can I fit an arbitrary function, like a psychometric function, e.g. cumulative gaussian with chance rate and lapse rate? Logistic is restricted to 0->1


how I Holcombe:fit psychometric functions and bootstrap

Debugging in R



After an error, calling traceback() gives you the stack

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,


Setting up a proxy in R on a Mac




For Sydney Uni, use:

Personal tools