291 lines
		
	
	
		
			9.6 KiB
		
	
	
	
		
			R
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			291 lines
		
	
	
		
			9.6 KiB
		
	
	
	
		
			R
		
	
	
		
			Executable File
		
	
	
	
	
install.packages("tidyverse")
 | 
						|
install.packages("qcc")
 | 
						|
install.packages("skimr")
 | 
						|
install.packages("rmarkdown")
 | 
						|
x=seq(1,10)
 | 
						|
y=seq(sapply(1:10,random(1,1)))
 | 
						|
?Random
 | 
						|
install.packages(DT)
 | 
						|
install.packages("DT")
 | 
						|
if (!require("DT")) install.packages('DT')
 | 
						|
library(DT)
 | 
						|
?DT
 | 
						|
class(datatable(iris))
 | 
						|
?htmlwidget
 | 
						|
??htmlwidget
 | 
						|
install.packages("palletteer")
 | 
						|
install.packages("paletteer")
 | 
						|
install.packages("gapminder")
 | 
						|
install.packages("ggthemes")
 | 
						|
install.packages("collapsebleTree")
 | 
						|
devtools::install_github("AdeelK93/collapsibleTree")
 | 
						|
install.packages("devtools")
 | 
						|
devtools::install_github("AdeelK93/collapsibleTree")
 | 
						|
install.packages("ggthemes")
 | 
						|
names(iris)
 | 
						|
?theme_tufte()
 | 
						|
names(iris)
 | 
						|
library(gapminder)
 | 
						|
attach(gapminder)
 | 
						|
gapminder<-gapminder %>%
 | 
						|
filter(year) %>%
 | 
						|
arrange(-pop) %>%
 | 
						|
slice(1:50) %>%
 | 
						|
mutate(GDP=gdpPercap*Pop)
 | 
						|
library(dplyr)
 | 
						|
gapminder<-gapminder %>%
 | 
						|
filter(year) %>%
 | 
						|
arrange(-pop) %>%
 | 
						|
slice(1:50) %>%
 | 
						|
mutate(GDP=gdpPercap*Pop)
 | 
						|
rlang::last_error
 | 
						|
rlang::last_error()
 | 
						|
names(gapminder)
 | 
						|
table(gapminder$year)
 | 
						|
class(gapminder$year)
 | 
						|
library(usethis)
 | 
						|
library(ggplot2)
 | 
						|
install.packages(c("bit", "boot", "brew", "broom", "bslib", "cachem", "callr", "class", "cli", "cluster", "codetools", "colorspace", "commonmark", "cpp11", "crayon", "curl", "data.table", "dbplyr", "devtools", "digest", "dplyr", "DT", "dtplyr", "evaluate", "fansi", "fastmap", "flexdashboard", "fontawesome", "forcats", "foreign", "fs", "gapminder", "gargle", "gert", "ggplot2", "gh", "gtable", "haven", "highr", "hms", "htmltools", "htmlwidgets", "httpuv", "httr", "isoband", "jsonlite", "knitr", "lifecycle", "lubridate", "markdown", "MASS", "Matrix", "mgcv", "modelr", "nlme", "nnet", "openssl", "paletteer", "pillar", "pkgbuild", "pkgdown", "pkgload", "processx", "ps", "purrr", "ragg", "Rcpp", "readr", "readxl", "repr", "reprex", "rlang", "rmarkdown", "roxygen2", "rpart", "rstudioapi", "rvest", "sass", "scales", "shiny", "skimr", "sourcetools", "spatial", "stringi", "stringr", "survival", "sys", "testthat", "tibble", "tidyr", "tidyselect", "tidyverse", "tinytex", "utf8", "vctrs", "viridisLite", "vroom", "whisker", "xfun", "yaml", "zip"))
 | 
						|
install.packages(c("bit", "boot", "brew", "broom", "bslib", "cachem", "callr", "class", "cli", "cluster", "codetools", "colorspace", "commonmark", "cpp11", "crayon", "curl", "data.table", "dbplyr", "devtools", "digest", "dplyr", "DT", "dtplyr", "evaluate", "fansi", "fastmap", "flexdashboard", "fontawesome", "forcats", "foreign", "fs", "gapminder", "gargle", "gert", "ggplot2", "gh", "gtable", "haven", "highr", "hms", "htmltools", "htmlwidgets", "httpuv", "httr", "isoband", "jsonlite", "knitr", "lifecycle", "lubridate", "markdown", "MASS", "Matrix", "mgcv", "modelr", "nlme", "nnet", "openssl", "paletteer", "pillar", "pkgbuild", "pkgdown", "pkgload", "processx", "ps", "purrr", "ragg", "Rcpp", "readr", "readxl", "repr", "reprex", "rlang", "rmarkdown", "roxygen2", "rpart", "rstudioapi", "rvest", "sass", "scales", "shiny", "skimr", "sourcetools", "spatial", "stringi", "stringr", "survival", "sys", "testthat", "tibble", "tidyr", "tidyselect", "tidyverse", "tinytex", "utf8", "vctrs", "viridisLite", "vroom", "whisker", "xfun", "yaml", "zip"))
 | 
						|
install.packages(c("bit", "boot", "brew", "broom", "bslib", "cachem", "callr", "class", "cli", "cluster", "codetools", "colorspace", "commonmark", "cpp11", "crayon", "curl", "data.table", "dbplyr", "devtools", "digest", "dplyr", "DT", "dtplyr", "evaluate", "fansi", "fastmap", "flexdashboard", "fontawesome", "forcats", "foreign", "fs", "gapminder", "gargle", "gert", "ggplot2", "gh", "gtable", "haven", "highr", "hms", "htmltools", "htmlwidgets", "httpuv", "httr", "isoband", "jsonlite", "knitr", "lifecycle", "lubridate", "markdown", "MASS", "Matrix", "mgcv", "modelr", "nlme", "nnet", "openssl", "paletteer", "pillar", "pkgbuild", "pkgdown", "pkgload", "processx", "ps", "purrr", "ragg", "Rcpp", "readr", "readxl", "repr", "reprex", "rlang", "rmarkdown", "roxygen2", "rpart", "rstudioapi", "rvest", "sass", "scales", "shiny", "skimr", "sourcetools", "spatial", "stringi", "stringr", "survival", "sys", "testthat", "tibble", "tidyr", "tidyselect", "tidyverse", "tinytex", "utf8", "vctrs", "viridisLite", "vroom", "whisker", "xfun", "yaml", "zip"))
 | 
						|
yes
 | 
						|
library(ggplot2)
 | 
						|
install.packages("usethis")
 | 
						|
usethis:edit_r_profile()
 | 
						|
library(usethis)
 | 
						|
usethis:edit_r_profile()
 | 
						|
usethis::edit_r_profile()
 | 
						|
options(
 | 
						|
usethis.description = list(
 | 
						|
`Authors@R` = 'person("jack", "leene", email = "jack@leene.dev", role = c("aut", "cre"))',
 | 
						|
License = "MIT + file LICENSE",
 | 
						|
Version = "0.0.0.9000"
 | 
						|
),
 | 
						|
usethis.full_name = "First Last",
 | 
						|
usethis.protocol = "https",
 | 
						|
vsc.rstudioapi = TRUE,
 | 
						|
warnPartialMatchArgs = TRUE,
 | 
						|
warnPartialMatchDollar = TRUE,
 | 
						|
warnPartialMatchAttr = TRUE
 | 
						|
)
 | 
						|
if (interactive()) {
 | 
						|
suppressMessages(require(devtools))
 | 
						|
suppressMessages(require(usethis))
 | 
						|
}
 | 
						|
p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line()
 | 
						|
p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line()
 | 
						|
p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line()
 | 
						|
library(ggplot2)
 | 
						|
library(DT)
 | 
						|
library(ggthemes)
 | 
						|
library(gapminder)
 | 
						|
p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line()
 | 
						|
q<-ggplot(iris,aes(Sepel.Width,Sepal.Length))+geom_line()+theme_tufte()
 | 
						|
(p)
 | 
						|
theme_tufte()
 | 
						|
data(gapminder)
 | 
						|
q
 | 
						|
theme_tufte()
 | 
						|
#gapminder<-gapminder %>%
 | 
						|
#  filter(year) %>%
 | 
						|
#  arrange(-pop) %>%
 | 
						|
#  slice(1:50) %>%
 | 
						|
#  mutate(GDP=gdpPercap*Pop)
 | 
						|
#Column {data-width=450}
 | 
						|
p=datatable((iris))
 | 
						|
print(p)
 | 
						|
library(ggplot2)
 | 
						|
library(DT)
 | 
						|
library(ggthemes)
 | 
						|
library(gapminder)
 | 
						|
p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line()
 | 
						|
q<-ggplot(iris,aes(Sepel.Width,Sepal.Length))+geom_line()+theme_tufte()
 | 
						|
p=datatable((iris))
 | 
						|
print(p)
 | 
						|
(p)
 | 
						|
theme_tufte()
 | 
						|
#gapminder<-gapminder %>%
 | 
						|
#  filter(year) %>%
 | 
						|
#  arrange(-pop) %>%
 | 
						|
#  slice(1:50) %>%
 | 
						|
#  mutate(GDP=gdpPercap*Pop)
 | 
						|
#Column {data-width=450}
 | 
						|
theme_tufte()
 | 
						|
library(ggplot2)
 | 
						|
library(DT)
 | 
						|
library(ggthemes)
 | 
						|
library(gapminder)
 | 
						|
p<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+geom_line()
 | 
						|
q<-ggplot(iris,aes(Sepel.Width,Sepal.Length))+geom_line()+theme_tufte()
 | 
						|
p=datatable((iris))
 | 
						|
print(p)
 | 
						|
(p)
 | 
						|
#theme_tufte()
 | 
						|
#gapminder<-gapminder %>%
 | 
						|
#  filter(year) %>%
 | 
						|
#  arrange(-pop) %>%
 | 
						|
#  slice(1:50) %>%
 | 
						|
#  mutate(GDP=gdpPercap*Pop)
 | 
						|
#Column {data-width=450}
 | 
						|
table(iris$Species)
 | 
						|
usethis::edit_rstudio_snippets("r")
 | 
						|
usethis::edit_rstudio_prefs()
 | 
						|
usethis::edit_r_profile()
 | 
						|
install.packages(c("class", "KernSmooth", "MASS", "nnet"))
 | 
						|
mtcars
 | 
						|
a<-mtcars
 | 
						|
a
 | 
						|
nrow(mtcars)
 | 
						|
floor(12/4-2)
 | 
						|
floor(2:32/4-2)
 | 
						|
floor(2:32/4-1)
 | 
						|
floor((1:32)/4-1)
 | 
						|
floor((1:32)/4)
 | 
						|
floor((1:32-1)/4)
 | 
						|
a$group=floor((1:32-1)/4)
 | 
						|
a
 | 
						|
a$group1=mod((1:32-1),4)
 | 
						|
((1:32-1)//4)
 | 
						|
((1:32-1)\\4)
 | 
						|
1\\4
 | 
						|
1//4
 | 
						|
mod(1,4()
 | 
						|
mod(1,4
 | 
						|
mod(1,4)
 | 
						|
mod(1 %%4)
 | 
						|
(1 %% 4)
 | 
						|
a$group1=(1:32 %% 4)
 | 
						|
a
 | 
						|
a$group1=(1:32 %% 4)+1
 | 
						|
a$group1=(0:31 %% 4)+1
 | 
						|
a$group1=(0:31 %% 4)
 | 
						|
a$group1=(1:32 %% 4)
 | 
						|
a<-mtcars
 | 
						|
floor(12/4-2)
 | 
						|
a$group=floor((1:32-1)/4)
 | 
						|
a
 | 
						|
a$group=floor((1:32-1) %% 4)
 | 
						|
a$group=floor((1:32-1)/4)
 | 
						|
a$group=floor((1:32-1)/4)
 | 
						|
a
 | 
						|
a$group2=((1:32-1)%% 4)
 | 
						|
a
 | 
						|
names(a)
 | 
						|
head(a)
 | 
						|
ddply(a,.(group,group2),sumc=sum(cyl))
 | 
						|
library(tidyverse)
 | 
						|
installed.packages("tidyverse")
 | 
						|
install.package("tidyverse")
 | 
						|
install.packages("tidyverse")
 | 
						|
library(tidyverse)
 | 
						|
head(a)
 | 
						|
ddply(a,.(group,group2),sumc=sum(cyl))
 | 
						|
library(dplyr)
 | 
						|
ddply(a,.(group,group2),sumc=sum(cyl))
 | 
						|
library(dplyr)
 | 
						|
ddply(a,.(group,group2),sumc=sum(cyl))
 | 
						|
ddplyr(a,.(group,group2),sumc=sum(cyl))
 | 
						|
ddply
 | 
						|
library(dplyr)
 | 
						|
library(plyr)
 | 
						|
install.packages("plyr")
 | 
						|
library(plyr)
 | 
						|
names(a)
 | 
						|
ddply(a,.(group,group2),summarize,sumc=sum(cyl),paste(.group,.group2,col="",sep="_")=sum(cyl))
 | 
						|
ddply(a,.(group,group2),summarize,sumc=sum(cyl),paste(.group,.group2,col="",sep="_")=sum(cyl))
 | 
						|
starwars %>%
 | 
						|
select(name, mass, species) %>%
 | 
						|
mutate(mass_norm = mass / mean(mass, na.rm = TRUE))
 | 
						|
head(a)
 | 
						|
a %>% pivot_wider()
 | 
						|
?pivot_wider
 | 
						|
map(a$group,function(x){sprinft(x)})
 | 
						|
map(a$group,function(x){sprinf(x)})
 | 
						|
map(a$group,function(x){prinf(x)})
 | 
						|
sprintf
 | 
						|
map(a$group,prinf(x))
 | 
						|
map(a$group,sprinf(x))
 | 
						|
map(a$group,sprinfs(x))
 | 
						|
help("paste")
 | 
						|
map(a$group,paste(x))
 | 
						|
map(a$group,paste(.x))
 | 
						|
map(a$group,paste(x))
 | 
						|
?map
 | 
						|
map(a$group,x)
 | 
						|
map(a$group,.x)
 | 
						|
set_names(c("foo", "bar")) |> map_chr(paste0, ":suffix")
 | 
						|
l1 <- list(list(a = 1L), list(a = NULL, b = 2L), list(b = 3L))
 | 
						|
ll
 | 
						|
l1
 | 
						|
l1 |> map("a", .default = "???")
 | 
						|
list(num = 1:3,     letters[1:3])
 | 
						|
1:10 |>
 | 
						|
map(rnorm, n = 10)
 | 
						|
1:10 |>
 | 
						|
map(\(x) rnorm(10, x))
 | 
						|
letters[1:10] |>
 | 
						|
map(\(x) sprintf("wafer_%03d",x))
 | 
						|
letters[1:10] |>
 | 
						|
map(\(int(x)) sprintf("wafer_%03d",x))
 | 
						|
letters[1:10] |>
 | 
						|
map(int(x) sprintf("wafer_%03d",x))
 | 
						|
letters[1:10] |>
 | 
						|
map(.x, sprintf("wafer_%03d",x))
 | 
						|
letters[1:10] |>
 | 
						|
map(x, sprintf("wafer_%03d",x))
 | 
						|
letters
 | 
						|
letters[1:10]
 | 
						|
letters[1:10] |>
 | 
						|
map(\x, sprintf("wafer_%03d",x))
 | 
						|
letters[1:10] |>
 | 
						|
map(\(x), sprintf("wafer_%03d",x))
 | 
						|
letters[1:10] |>
 | 
						|
map(\x, sprintf("wafer_%03d",x))
 | 
						|
letters[1:10] |>
 | 
						|
map(x, sprintf("wafer_%03d",x))
 | 
						|
[1:10] |>
 | 
						|
1:10 |> map(x, sprintf("wafer_%03d",x))
 | 
						|
1:10 |> map(x, sprintf("wafer_%03d", x))
 | 
						|
1:10 |> map_chr(x, sprintf("wafer_%03d", x))
 | 
						|
1:10 |> map_in5(x, sprintf("wafer_%03d", x))
 | 
						|
1:10 |> map_int(x, sprintf("wafer_%03d", x))
 | 
						|
1:10 |> map(x, sprintf("wafer_%03d", x))
 | 
						|
l2 <- list(
 | 
						|
list(num = 1:3,     letters[1:3]),
 | 
						|
list(num = 101:103, letters[4:6]),
 | 
						|
list()
 | 
						|
)
 | 
						|
l2 |> map(c(2, 2))
 | 
						|
l2 |> map(list("num", 3))
 | 
						|
l2 |> map_int(list("num", 3), .default = NA)
 | 
						|
paste(sprintf("wafer_%03d",1:10))
 | 
						|
seq(paste(sprintf("wafer_%03d",1:10)),3)
 | 
						|
paste(sprintf("wafer_%03d",seq(1:10,3))
 | 
						|
)
 | 
						|
paste(sprintf("wafer_%03d",seq(1:10,3))
 | 
						|
)
 | 
						|
seq(3,1:2)
 | 
						|
seq(1:2,2)
 | 
						|
seq(1:2,a:b)
 | 
						|
seq(a,b)
 | 
						|
seq(1,3)
 | 
						|
R
 | 
						|
which R
 | 
						|
setwd("/Users/jackleene/2024-dash_v1")
 | 
						|
setwd("/Users/jackleene/2024-dash_v1/data")
 | 
						|
a=read_csv("spc_mod.csv")
 | 
						|
library(readr)
 | 
						|
a=read_csv("spc_mod.csv")
 | 
						|
library(arrow)
 | 
						|
install.packages("arrow")
 | 
						|
install.packages("arrow")
 | 
						|
install.packages("sparklyr")
 | 
						|
install.packages("sparklyr")
 | 
						|
install.packages("arrow")
 | 
						|
table(a$timestamp)
 | 
						|
install.packages("arrow")
 | 
						|
names(a)
 | 
						|
class(a)
 | 
						|
lapply(a,class)
 | 
						|
lapply(a,class)
 |