Skip to content

Commit

Permalink
Updating data import
Browse files Browse the repository at this point in the history
Updating code to set stringsAsFactors=TRUE.
  • Loading branch information
keithlohse committed Oct 14, 2020
1 parent 9b0d399 commit a4dddaf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 55 deletions.
2 changes: 1 addition & 1 deletion ACRM_2018/scripts/acrm_practical_session1.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ list.files()
# Import the .csv file into R.
# We will save this file in the R environment as an object called "DATA".
DATA<-read.csv("./data/data_session1.csv", header = TRUE, sep=",",
na.strings=c("NA","NaN"," ",""))
na.strings=c("NA","NaN"," ",""), stringsAsFactors = TRUE)

# Use the head() function to check the structure of the data file.
head(DATA)
Expand Down
2 changes: 1 addition & 1 deletion ACRM_2018/scripts/acrm_practical_session2.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ list.files()
# Import the .csv file into R.
# We will save this file in the R environment as an object called "DATA".
DATA<-read.csv("./data/data_session2.csv", header = TRUE, sep=",",
na.strings=c("NA","NaN"," ",""))
na.strings=c("NA","NaN"," ",""), stringsAsFactors = TRUE)

# Use the head() function to check the structure of the data file.
head(DATA)
Expand Down
2 changes: 1 addition & 1 deletion ACRM_2018/scripts/acrm_practical_session3.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ list.files()
# Import the .csv file into R.
# We will save this file in the R environment as an object called "DATA".
DATA<-read.csv("./data_session3.csv", header = TRUE, sep=",",
na.strings=c("NA","NaN"," ",""))
na.strings=c("NA","NaN"," ",""), stringsAsFactors = TRUE)

# Use the head() function to check the structure of the data file.
head(DATA)
Expand Down
67 changes: 15 additions & 52 deletions READ_ME.txt
Original file line number Diff line number Diff line change
@@ -1,66 +1,29 @@
##-------------------------
# Linear Mixed Effects Regression (LMER) Reading Group
# Keith Lohse, PhD
# Keith Lohse, PhD, PStat
# Auburn Univeristy
# [email protected]
# 2016-06-06
# 2020-09-29

The data and script files in this folder were created by Keith Lohse (me) at
Auburn University for a summer reading group on Linear Mixed Effect
Regression (LMER). The code builds on code originally written by Jeff Long
at the University of Iowa and follows his book "Longitudinal Data Analysis for
the Behavioral Sciences Using R". The goal of the reading group was to work
through this book chapter by chapter and the scripts/data in this folder are
the end result of that exercise.

When appropriate, I have replicated and updated Dr. Long's code (i.e., showing
solutions using both plyr (original) and dplyr (more recent)) and I have tried
to thoroughly comment Dr. Long's code, explaining what the code is doing at
each step. (The original code available from the publisher has essentially zero
comments.)
If you are installing R and R Studio for the first time see:
https://www.youtube.com/watch?v=enLJZQJT51o

There are also some situations were we use code and data completely separate
from Dr. Long's book. These are original data that were collected in the
Rehabilitation Informatics Laboratory at Auburn University. All of the
necessary data are stored in this folder, so the new code should run smoothly
for everyone provided that you have all of the files saved to your working
directory and that you have installed all of the necessary packages (code
for installing these packages is included at the beginning of each script
file).
## LAB #1
Module 1A: https://www.youtube.com/watch?v=k5l7eARAD4A (7 min)
Module 1B: https://www.youtube.com/watch?v=PJ01H1ZL0ro (10 min)
Module 1C: https://www.youtube.com/watch?v=vVAdwsaMlOs (10 min)
Module 1D: https://www.youtube.com/watch?v=JIQfJ8BU3HM (13 min)
Module 1E: https://www.youtube.com/watch?v=TZXePRRRdho (15 min)

## LAB #2
Module 2: https://www.youtube.com/watch?v=bgoorixQmlU (16 min)

##--------------------------
# File Structure
## LAB #3
Module 3A: https://www.youtube.com/watch?v=2rUPCr0I2KI (10 min)
Module 3B: https://www.youtube.com/watch?v=VHyqwe4RlzI (11 min)

For all of these scripts/data, the working assumption is that you create two
folders within your working directory:
1. data
2. scripts

In my code, I try to use relative rather than absolute references when possible,
but please note that file pathways will need to be updated to be specific to
your computer. I do, however, try to point out when you need to do this in the
code. For instance, use the getwd() function in R to find what your current
working directory is, and then use the setwd() function to change it. As you
will see in my code, I always adjust my working directory to
> setwd("C:/Currant/LMER_reading_group/")

... and within the "LMER_reading_group" folder, I have separate folders called
"data" and "scripts" in which I store all of the data files and script files.


##--------------------------
# Progressing Through the Chapters

In general, we progress through Dr. Long's textbook chapter by chapter. The
first two chapters are more conceptual and don't really have a lot of R code
to go along with them as such, I recommend that you read the first two
and then start working on the LMER_basics.R script file. From there, you
can just go chapter by chapter and *hopefully* all of the updated code will
work for you. The titles of the script files should line up with the chapters
pretty intuitively, that is, "LMER_long3.R" should be completed while reading
or after reading Chapter 3 from Dr. Long's textbook ("LMER_long4.R" goes with
Chapter 4, etc.).



Expand Down

0 comments on commit a4dddaf

Please sign in to comment.