Code
<- here("raw_data", "data_day_3" ,"Kronisk smerte - udvikling.csv")
path read.csv(path)
read.csv2(path)
read_csv2(path)
Steen Flammild Harsted
January 10, 2024
data_day_3.zip
file from ItsLearning and unzip it in your raw_data
directoryThe unzipped folder contains:
Frame
and Time_Seconds
are time variablesCGY
gives you the height (in mm) of their center of gravitychallenge
that you need if you want to solve the challenge assignmentread.csv()
read.csv2()
read_csv2()
id_age.csv
and id_sex.dta
, combine them (use full_join()
), and assign the combined dataframe to an objecttidyverse
includes the haven
package that can read Stata´s .dta fileshaven::read_dta()
dplyr
function full_join()
will help you to combine the two imported objects.list.files()
to generate an object called files
containing the filenames of the 19 motioncapture filespattern =
argument in list.files()
, pattern = NULL # The default setting. List all files in our directory
, pattern = ".csv$" # all files in our directory that ends with ".csv"
, pattern = "^desc" # all files in our directory that starts with "desc"
, pattern = "[0-9].csv$" # all files in our directory that ends with "[a number from 0-9].csv"
file =
should include the path to the folder (use here()
), and the files
object you just created.levels = c(1,2), labels = c("Boy", "Girl")
CGY
for each of the childrenchallenge
vroom
and load itvroom
is a very fast package for importing .csv
files. (hence the name)vroom
package is vroom()
vroom()
has the argument delim =
that allows you specify the delimter you wantvroom()
id
argument in the vroom()
function do?vroom()
to import all the mocap files in the challenge folderid =
argument in the vroom()
function.ID
that only contains the ID
part from the filenamestr_extract()
and str_remove()
pattern =
argument that must be a regular expressionmutate()
call