tayamacro.blogg.se

Rmarkdown print variable
Rmarkdown print variable








rmarkdown print variable

"The data in "tab:logregresultstable", var, ")" ), " ", ""), For example’s sake, I am using 0.5 p-value as a threshold. We pull the important variables using the p-value again. Now, we report out the results from the logistic regression models. We have to add a few newline characters to make sure our final results look good. if the p-value is less than or equal to 0.05, there is a relationship between that variable and the total giving variable. Next, using the p-values from the ANOVA results, we write a conditional sentence i.e. Then using the kable function and some functions from the kableExtra package we create a proportions table to our liking. We use the adorn functions to add percentages and totals. You will see that I am using two exclamation marks and sym function to get the underlying column name from the looping variable. We create the proportions table using the tabyl function from the janitor package. We write a generic sentence to provide a reference to the proportions table. We then create a markdown subsection for that variable.

rmarkdown print variable

"** the presence of a relationship with a $p$-value of ",įirst, we create a loop to go through the variables we want to report on. Ifelse(aov_df$p.value <= 0.05, "confirmed", "did not confirm"), "A one-way analysis of variance was conducted to further investigate the strength of the relationship between giving group status and", Pearson_df <- filter(pearson_values, source = var) Kable_styling(latex_options = "scale_down")Īov_df <- filter(aov_values, source = var, term = ".x") Of course, this can be done running summary(), but we want to see how we can this function for complex use cases.Īdorn_pct_formatting(rounding = "half up", digits = 2) %>%

rmarkdown print variable

We want to find the mean of each of those variables.

rmarkdown print variable

We have two variables in our data frame x and y. In our case, we want to apply statistical tests to each variable in our dataset. The map function is similar to the apply family of functions in that you can apply any function to a list and do something with the results. Line # 41 Map Functionsīefore we generate statistical results, let’s take a detour to understand the map functions from the package purr. I also replaced the underscores in the variable names with spaces. Lines # 31-37.įinally, I replaced the missing values from a numeric variable with the median of that variable and for a character variable, I used Mode value of that variable. I added a few fake variables and randomly generated their values. Then I created buckets using the Total Giving variable. Then, I selected a few variables of importance. Names(sample_data_refi) <- gsub("_", " ", names(sample_data_refi))įirst, I removed any non-alumni from the dataset. Mutate(ON_CAMPUS_RESIDENCE = sample(c("Y", "N"), size = nrow(.), replace = TRUE)) %>%










Rmarkdown print variable