Last active
April 20, 2023 14:22
-
-
Save graebnerc/ae8b0b7cddcd87a107d3715b3d9ce819 to your computer and use it in GitHub Desktop.
Scripts containing the code developed during the 7th lecture on project management and data import, as well as solutions to the exercises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scripts containing the code developed during the 7th lecture on project management and data import, as well as solutions to the exercises. | |
The code assumes that you created a folder structure as discussed during the lecture: | |
YourProject/ | |
|─ YourProject.Rproj | |
├─ data/ | |
│ ├─ raw/ | |
| |─fread_expls-1.csv | |
| |─fread_expls-2.csv | |
| |─fread_expls-3.csv | |
| ├─ tidy/ | |
├─ R/ | |
│ ├─ exercise_1.R | |
│ ├─ exercise_2.R | |
│ ├─ exercise_3.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here::i_am("R/exercise_1.R") | |
library(here) | |
library(data.table) | |
data_path <- here::here("data/raw/fread_expls-1.csv") | |
ex_1_data <- data.table::fread( | |
file = data_path) | |
ex_1_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here::i_am("R/exercise_2.R") | |
library(here) | |
library(data.table) | |
data_path <- here::here("data/raw/fread_expls-2.csv") | |
ex_2_data <- data.table::fread( | |
file = data_path, | |
sep = "'", | |
dec = ":") | |
ex_2_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here::i_am("R/exercise_3.R") | |
library(here) | |
library(data.table) | |
data_path <- here::here("data/raw/fread_expls-3.csv") | |
ex_3_data <- data.table::fread( | |
file = data_path, | |
colClasses = c( | |
"commoditycode"="character", | |
"cgroup"="factor") | |
) | |
str(ex_3_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment