knitr::opts_chunk$set(echo = TRUE) library(tidyverse) library(surveyreader) df_raw <- readxl::read_xlsx( path = "C:/Users/Daniel Antal/OneDrive - Visegrad Investments/2018 Projektek/surveyreader/data-raw/zeneipari_2017.xlsx", sheet = 1, skip = 2, col_names = TRUE ) metadata <- readxl::read_excel( path = "C:/Users/Daniel Antal/OneDrive - Visegrad Investments/2018 Projektek/surveyreader/data-raw/musician_hu_2017.xlsx", sheet = 2, range = "a1:l274" )
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
df_logical <- df_raw %>% purrr::set_names(., metadata$var_name) %>% dplyr::select ( dplyr::starts_with ("is_")) %>% purrr::map_df (., function(x) str_sub(x, 1, 3) ) %>% purrr::map_df (., function(x) chr_logical(x, na_id = "NA")) summary (df_logical)
You can also embed plots, for example:
df_gender <- df_raw %>% set_names(., metadata$var_name) %>% select ( which ( metadata$type == "code_gender") ) %>% map_df (., function(x) code_gender(x, na_id = "NA")) summary (df_gender)
df_scale <- df_raw %>% set_names(., metadata$var_name) %>% select ( which ( metadata$type == "scale_factor")) %>% map_df (., function(x) chr_numeric(x, digits = 1, na_id = "NA")) %>% mutate ( difficulty_bills = ifelse ( is.na(difficulty_bills), difficulty_bills_abroad, difficulty_bills)) %>% mutate ( subjective_urbanization = ifelse ( is.na(subjective_urbanization), yes = subjective_urbanization_abroad, no = subjective_urbanization)) summary (df_scale)
Note that the echo = FALSE
parameter was added to the code chunk to prevent printing of the R code that generated the plot.
df_outlook <- df_raw %>% set_names(., metadata$var_name) %>% select ( which ( metadata$type == "better_worse_3")) %>% map_df (., function(x) better_worse_3(x, language = "HU", na_id = "NA")) summary (df_outlook)
bla bala
metadata_numeric_3 <- metadata %>% filter ( type == "numeric") %>% filter ( default == "3") df_numeric_3 <- df_raw %>% set_names(., metadata$var_name) %>% select ( one_of(metadata_numeric_3$var_name )) %>% map_df (., function(x) gsub("több", 999, x)) %>% map_df (., function(x) chr_numeric(x, digits = 3, na_id = "NA ")) %>% map_df (., function(x) moderate_more (as.vector(x), moderate = 999) ) summary (df_numeric_3)
metadata_numeric <- metadata %>% filter ( type == "numeric") %>% mutate ( default = ifelse(is.na(default), 9, default)) %>% filter ( default != "3") df_numeric <- df_raw %>% set_names(., metadata$var_name) %>% select ( one_of(metadata_numeric$var_name)) %>% map_df (., function(x) gsub("több", 99999, x)) %>% map_df (., function(x) chr_numeric(x, digits = NA, na_id = "NA ")) %>% map_df (., function(x) moderate_more (as.vector(x), moderate = 99999) ) df_quasi_numeric <- df_numeric %>% select ( starts_with("big_five"), starts_with ("cstp_")) df_numeric <- df_numeric %>% select ( -starts_with("big_five"), -starts_with ("cstp_")) summary (df_numeric)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.