-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
67 lines (67 loc) · 1.64 KB
/
.Rhistory
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
64
65
66
67
source('goals.R')
as.data.frame(cfiles <- list.files(path = dir, pattern = "*.md", full.names = TRUE)
files <- list.files(path = dir, pattern = "*.md", full.names = TRUE)
file = files[0]
file
files
file = files[1]
file
file_content <- readLines(file)
yaml_lines <- grep("---", file_content)
scan(file)
file_content <- readLines(file)
yaml_lines <- grep("---", file_content)
yaml_start <- yaml_lines[1] + 1
yaml_end <- yaml_lines[2] - 1
yaml_list <- file_content[(yaml_start):(yaml_end)]
yaml_text = paste(yaml_list, collapse = "\n")
yaml_data <- yaml::read_yaml(text=yaml_text)
yaml_data
yaml_data$x = NULL
as_tibble(yaml_data)
yaml_data
yaml_data[['draft']] = NULL
yaml_data
is.null(yaml_data['x'])
is.null(yaml_data['iii'])
field
source('goals.R')
source('goals.R')
file
yaml_data
file_content <- readLines(file)
yaml_lines <- grep("---", file_content)
yaml_start <- yaml_lines[1] + 1
yaml_end <- yaml_lines[2] - 1
# yaml content
yaml_list <- file_content[(yaml_start):(yaml_end)]
yaml_text = paste(yaml_list, collapse = "\n")
yaml_data <- yaml::read_yaml(text=yaml_text)
yaml_data
list_fields <- names(yaml_data)[sapply(yaml_data, function(x) is.vector(x) && length(x) > 1)]
list_fields
yaml_data
as.data.frame(yaml_data)
yaml_text
print(yaml_text)
cat(yaml_text)
is.null(yaml_data['update'])
yaml_data[['update']]
yaml_data[['updatee']]
yaml_data[['updated']]
yaml_data['updated']
yaml_data
names(yaml_data)
yaml_data[['title']]
for(field in names(yaml_data)){
if(is.null(yaml_data[[field]])){
yaml_data[[field]] <- NA
}
}
yaml_data
astibble::as_tibble(yaml_data)
}
tibble::as_tibble(yaml_data)
source('goals.R')
source('goals.R')
source('goals.R')