-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPA_botscan_data.Rmd
64 lines (46 loc) · 985 Bytes
/
PA_botscan_data.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: "PA_botscan_data"
output: html_document
---
Load tidyverse
```{r}
library(tidyverse)
```
Set working directory
```{r}
setwd("D:/Users/Kurt/Documents/Research/Dissertation/Data/botscan")
```
List all files needing to be combined
```{r}
files <- dir(getwd(), all.files = FALSE, full.names = TRUE, recursive = TRUE)
```
Create initial dataframe
```{r}
load(files[1])
botscan_data = diss_botscan_results_economy_011520
rm(diss_botscan_results_economy_011520)
```
Remove repeated data
```{r}
files = files[-1]
```
Create function
```{r}
loadRData <- function(fileName){
#loads an RData file, and returns it
load(fileName)
get(ls()[ls() != "fileName"])
}
```
Create remaining dataframe
```{r}
for(file in files){
current_file = loadRData(file)
botscan_data = dplyr::bind_rows(botscan_data, current_file)
rm(file)
}
```
Write file
```{r}
save(botscan_data, file = "D:/Users/Kurt/Documents/Research/Dissertation/Data/botscan/botscan_data.RData")
```