-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
127 lines (127 loc) · 4.98 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
library(processanimateR) ##animates process
my_flags <- data.frame(value = c(0,2,4,8,16)) %>%
mutate(mins = days(value))
library(dplyr) ##pipes and tidy code
# Libraries ---------------------------------------------------------------
library(dplyr) ##pipes and tidy code
library(lubridate) ##date time
library(bupaR) ##buisness process analytics
library(processanimateR) ##animates process
# Create performance times ------------------------------------------------
my_flags <- data.frame(value = c(0,2,4,8,16)) %>%
mutate(mins = days(value))
my_timeflags <- patients %>%
cases %>%
crossing(my_flags) %>%
mutate(time = start_timestamp + mins) %>%
filter(time <= complete_timestamp) %>%
select("case" = patient,time,value) ##must be case, time, value
# Animate process ---------------------------------------------------------
patients %>%
animate_process(mode ="absolute",
jitter=10,
legend = "color",
mapping = token_aes(
color = token_scale(my_timeflags
, scale = "ordinal"
, domain = my_flags$value
, range = rev(RColorBrewer::brewer.pal(5,"Spectral"))
)))
# Libraries ---------------------------------------------------------------
library(tidyverse) ##pipes and tidy code
library(lubridate) ##date time
library(bupaR) ##buisness process analytics
library(processanimateR) ##animates process
# Create performance times ------------------------------------------------
my_flags <- data.frame(value = c(0,2,4,8,16)) %>%
mutate(mins = days(value))
my_timeflags <- patients %>%
cases %>%
crossing(my_flags) %>%
mutate(time = start_timestamp + mins) %>%
filter(time <= complete_timestamp) %>%
select("case" = patient,time,value) ##must be case, time, value
# Animate process ---------------------------------------------------------
patients %>%
animate_process(mode ="absolute",
jitter=10,
legend = "color",
mapping = token_aes(
color = token_scale(my_timeflags
, scale = "ordinal"
, domain = my_flags$value
, range = rev(RColorBrewer::brewer.pal(5,"Spectral"))
)))
source('//ntpcts60.nntha.loc/shared_info/CSUs/NECS/Information Services/Analysis/Teams/Projects/Dominic/ProcessAnimateR_vignette/ProcessAnimateR_vignette.R', echo=TRUE)
source('//ntpcts60.nntha.loc/shared_info/CSUs/NECS/Information Services/Analysis/Teams/Projects/Dominic/ProcessAnimateR_vignette/ProcessAnimateR_vignette.R', echo=TRUE)
library(knitr)
update(knitr)
update.packages('knitr')
file.edit("~/.Renviron")
local({
# The directory where Pandoc will be extracted. Feel free
# to adjust this path as appropriate.
dir <- "~/rstudio-pandoc"
# The version of Pandoc to be installed.
version <- "2.7.1"
# Create and move to the requested directory.
dir.create(dir, showWarnings = FALSE, recursive = TRUE)
owd <- setwd(dir)
on.exit(setwd(owd), add = TRUE)
# Construct path to pandoc.
root <- "https://s3.amazonaws.com/rstudio-buildtools"
suffix <- sprintf("pandoc-%s-windows-x86_64.zip", version)
url <- file.path(root, "pandoc-rstudio", version, suffix)
# Download and extract pandoc.
file <- basename(url)
utils::download.file(url, destfile = file)
utils::unzip(file)
unlink(file)
# Write .Renviron to update the version of Pandoc used.
entry <- paste("RSTUDIO_PANDOC", shQuote(path.expand(dir)), sep = " = ")
contents <- if (file.exists("~/.Renviron")) readLines("~/.Renviron")
filtered <- grep("^RSTUDIO_PANDOC", contents, value = TRUE, invert = TRUE)
amended <- union(filtered, entry)
writeLines(amended, "~/.Renviron")
# Report change to the user.
writeLines("Updated .Renviron:\n")
writeLines(amended)
writeLines("\nPlease restart RStudio for these changes to take effect.")
})
.libPaths()
x <- libPaths()
x <- .libPaths()
myPaths <- .libPaths() # get the paths
myPaths <- c(myPaths[2], myPaths[1]) # switch them
.libPaths(myPaths) # reassign them
.libPaths('//pdc-sys-fil-01.systems.informatix.loc/NECSU_Home/Dominic.Rowney/Documents/R/win-library/3.5')
local({
# The directory where Pandoc will be extracted. Feel free
# to adjust this path as appropriate.
dir <- "//pdc-sys-fil-01.systems.informatix.loc/NECSU_Home/Dominic.Rowney/Documents/R/win-library/3.5/rstudio-pandoc"
# The version of Pandoc to be installed.
version <- "2.7.1"
# Create and move to the requested directory.
dir.create(dir, showWarnings = FALSE, recursive = TRUE)
owd <- setwd(dir)
on.exit(setwd(owd), add = TRUE)
# Construct path to pandoc.
root <- "https://s3.amazonaws.com/rstudio-buildtools"
suffix <- sprintf("pandoc-%s-windows-x86_64.zip", version)
url <- file.path(root, "pandoc-rstudio", version, suffix)
# Download and extract pandoc.
file <- basename(url)
utils::download.file(url, destfile = file)
utils::unzip(file)
unlink(file)
# Write .Renviron to update the version of Pandoc used.
entry <- paste("RSTUDIO_PANDOC", shQuote(path.expand(dir)), sep = " = ")
contents <- if (file.exists("~/.Renviron")) readLines("~/.Renviron")
filtered <- grep("^RSTUDIO_PANDOC", contents, value = TRUE, invert = TRUE)
amended <- union(filtered, entry)
writeLines(amended, "~/.Renviron")
# Report change to the user.
writeLines("Updated .Renviron:\n")
writeLines(amended)
writeLines("\nPlease restart RStudio for these changes to take effect.")
})