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
library(dplyr) | |
iris %>% filter(grepl("se", Species)) |
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
library(tidyr) | |
library(dplyr) | |
df <- data.frame(x = c(NA, "a|b", "a|d", "b|c")) | |
df %>% separate(x, c("word1", "word2")) |
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
library(broom) | |
tidy(glimpse(mtcars)) |
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
Rscript -e "shiny::runApp('poldata_app.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
# create a test file | |
write.table(iris, "iris.csv", sep = ",", quote = FALSE, row.names = FALSE) | |
# create an empty database. | |
# can skip this step if database already exists. | |
sqldf("attach testingdb as new") | |
# or: cat(file = "testingdb") | |
# read into table called iris in the testingdb sqlite database | |
library(sqldf) |
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
library(shiny) | |
library(dplyr) | |
library(ggplot2) | |
ui = fluidPage( | |
tabsetPanel( | |
tabPanel("Plot", | |
plotOutput("my_plot") | |
), | |
tabPanel("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
# hide and show elements using conditional panel | |
library(shiny) | |
ui = basicPage( | |
checkboxInput("show", "Show datatable", | |
value = FALSE), | |
conditionalPanel("input.show == true", | |
dataTableOutput("mtcars")) | |
) |
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
library(shiny) | |
library(dplyr) | |
library(readr) | |
load(url("http://s3.amazonaws.com/assets.datacamp.com/production/course_4850/datasets/movies.Rdata")) | |
# UI | |
ui <- fluidPage( | |
sidebarLayout( | |
# Input(s) |
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
library(shiny) | |
library(dplyr) | |
library(readr) | |
load(url("http://s3.amazonaws.com/assets.datacamp.com/production/course_4850/datasets/movies.Rdata")) | |
# UI | |
ui <- fluidPage( | |
sidebarLayout( | |
# Input(s) |
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
library(shiny) | |
ui = basicPage( | |
textInput("txt1", "Input the first string"), | |
textInput("txt2", "Input the second string"), | |
uiOutput("cat_str") | |
) | |
server = function(input, output) { |