R function example

library(broom)
library(compute.es)
library(dplyr)
library(forcats)
library(FSA)
library(gapminder)
library(ggplot2)
library(gmodels)
library(haven)
library(here)
library(leaflet)
library(magrittr)
library(markdown)
library(MatchIt)
library(plyr)
library(psych)
library(purrr)
library(readr)
library(readxl)
library(sas7bdat)
library(sf)
library(sqldf)
library(stringr)
library(summarytools)
library(tidyverse)
library(tmap)
library(tmaptools)
library(descr)
library(writexl)

library(tidyverse)

table1

show_example<-function(var1,var2){

var1_d <-deparse(substitute(var1))
var2_d <-deparse(substitute(var2))

table1 %>%
mutate(prop_cases=table1[[var1_d]]/table1[[var2_d]]) -> temp123
Summarize(temp123$prop_cases ~ country, data= temp123) -> kaz

}

result1<-show_example(var1=cases,var2=population)
result2<-show_example(var1=cases,var2=cases)

CategoriesR

Leave a Reply