Wednesday, August 30, 2017

R manipulating data frames

Basic tutorial
http://www.r-tutor.com/r-introduction/data-frame

data.frame() Documentation
https://stat.ethz.ch/R-manual/R-devel/library/base/html/data.frame.html

data frame manipulation
https://www.datacamp.com/community/tutorials/15-easy-solutions-data-frame-problems-r#gs.g8nD2Tk

Edit data
fix(dataset)
How to import SPSS data (.sav) file into R.
https://www.r-bloggers.com/how-to-open-an-spss-file-into-r/

library(foreign)
dataset = read.spss(file.choose(), to.data.frame=TRUE)

To view the data set.
View(dataset)

09/16/2017
I stumbled across a newer package for importing and exporting data. It's called rio.

Links to package information:
https://cran.r-project.org/web/packages/rio/index.html

https://cran.r-project.org/web/packages/rio/vignettes/rio.html

https://cran.r-project.org/web/packages/rio/README.html

Installing rio:
> install.packages("rio", dependencies = TRUE)
> library("rio")

Importing a file:
> dataFile = import(file.choose())