More about this website.


1 Useful functions

1.0.1 read_spss(){haven}

Read spss files via haven (DIE HIER EHER DATAMANAGEMENT)

ess <- read_spss(file = "data/ESS7e02_1.sav",
                 user_na = TRUE)

1.0.2 read_dta(){readstata13}

Read dta files

lala <- read_dta(file = "blabla",version = 13)

1.0.3 within(data,{befehl})

Execute r command within data environment. Returns modified dataset.{} make sure that commands are executed across several lines.

data(iris)
summary(iris$Sepal.Length)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   4.300   5.100   5.800   5.843   6.400   7.900
iris <- within(iris,{
  Sepal.Length <- Sepal.Length + 10
})
summary(iris$Sepal.Length)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   14.30   15.10   15.80   15.84   16.40   17.90

1.0.4 `table(x)


1.0.5 prop.table()


1.0.6 summary(x)


1.0.7 mean(x)


1.0.8 sum(x)


1.0.9 sd(x)


1.0.10 median(x)

1.0.11 round(2)

1.0.12 factor()