5 General Demographics Dashboard Functions
5.1 Wrangling Functions
5.1.1 wrangle_general
5.1.1.1 Main Documentation
Wrangles raw general demographics data
Description:
Reads the input course's raw 'generalized_demographics.csv' and
outputs a cleaned version as wrangled_demographics.csv within the
same directory
Usage:
wrangle_general(input_course)
Arguments:
input_course: String value of input course short name
Value:
No value is returned
Examples:
wrangle_general('psyc1')
5.1.2 obtain_raw_general_data
5.1.2.1 Main Documentation
Obtains raw general demographic data
Description:
Obtains raw general demographic data
Usage:
obtain_raw_general_data(input_course)
Arguments:
input_course: String value of input course short name
Value:
Returns a data frame with the raw general demographic data
Examples:
obtain_raw_general_data('psyc1')
5.1.3 obtain_language_info
5.1.3.1 Main Documentation
Obtains a data frame with language information
Description:
Reads in a .csv containing languages and their ISO code.
Usage:
obtain_language_info()
Value:
Returns a data frame with languages and their corresponding ISO
codes
Examples:
obtain_language_info()
5.1.4 obtain_country_info
5.1.4.1 Main Documentation
Obtains a data frame with countries and ISO codes of their associated
languages
Description:
Obtains a data frame with countries and ISO codes of their
associated languages
Usage:
obtain_country_info()
Value:
Data frame with countries and their associated ISO language codes
Examples:
obtain_country_info()
5.1.5 prepare_general_data
5.1.5.1 Main Documentation
Cleans raw demographic data
Description:
Cleans raw demographic data
Usage:
prepare_general_data(data, language_info, country_info)
Arguments:
data: Data frame containing student demographic information
language_info: Data frame containing languages and their associated ISO
codes
country_info: Data frame with countries and their associated languages
as ISO codes
Value:
Cleaned data frame containing demographic information
Examples:
prepare_general_data(obtain_raw_general_data('psyc1'), language_info(), country_info())
5.1.6 write_general_data
5.1.6.1 Main Documentation
Writes cleaned demographic data frame as a .csv to the specified course
Description:
Writes cleaned demographic data frame as a .csv to the specified
course
Usage:
write_general_data(input_course, data)
Arguments:
input_course: String value of course short name
data: The data frame containing cleaned demographic data
Value:
No value is returned
Examples:
write_general_data('psyc1', cleaned_demographic_data)
5.2 Server Functions
5.2.1 convert_loe
5.2.1.1 Main Documentation
Converts level of education code to explicit string
Description:
Converts level of education code to explicit string
Usage:
convert_loe(LoE)
Arguments:
LoE: String value of level of education code
Value:
Returns explicit string value of level of education
5.2.2 get_loe_df
5.2.2.1 Main Documentation
Returns aggregated level of education data frame
Description:
Returns aggregated level of education data frame
Usage:
get_loe_df(data)
Arguments:
data: Data frame containing explicit level of education of students
Value:
Data frame containing aggregated level of education
5.2.3 get_loe_plot
5.2.3.1 Main Documentation
Returns plot with level of education of students
Description:
Returns plot with level of education of students
Usage:
get_loe_plot(loe_df)
Arguments:
loe_df: Data frame containing studentes aggregated by level of
education
Value:
Returns a ggplot geom_bar object
5.2.4 get_age_df
5.2.4.1 Main Documentation
Returns dataframe with student's ages
Description:
Returns dataframe with student's ages
Usage:
get_age_df(data)
Arguments:
data: Dataframe containing year of birth
Value:
Returns a dataframe with student's ages
5.2.5 get_age_plot
5.2.5.1 Main Documentation
Returns histogram plot of student's age
Description:
Returns histogram plot of student's age
Usage:
get_age_plot(age_df)
Arguments:
age_df: Data frame containing age of students
Value:
Returns a ggplot geom_histogram object
5.2.6 get_top_country_df
5.2.6.1 Main Documentation
Returns country aggregated data frame
Description:
Returns country aggregated data frame
Usage:
get_top_country_df(data, top_selection)
Arguments:
data: Data frame containing students' country
top_selection: The number of countries to include in output data frame
Value:
A data frame containing countries with the most number of students
5.2.7 get_country_plot
5.2.7.1 Main Documentation
Returns a plot containing student country distribution
Description:
Returns a plot containing student country distribution
Usage:
get_country_plot(country_df, top_selection)
Arguments:
country_df: Data frame of students aggregated by country
top_selection: The number of countries to include in the plot
Value:
Returns a ggplot geom_bar object
5.2.8 get_top_language_df
5.2.8.1 Main Documentation
Returns a language aggregated data frame
Description:
Returns a language aggregated data frame
Usage:
get_top_language_df(data, top_selection)
Arguments:
data: Data frame containing student language information
top_selection: Number of languages to include within the data frame
Value:
A data frame containing languages with the most number of students
who speak it
5.2.9 get_language_plot
5.2.9.1 Main Documentation
Returns plot of language aggregated information
Description:
Returns plot of language aggregated information
Usage:
get_language_plot(language_df, top_selection)
Arguments:
language_df: Data frame with aggregated language information
top_selection: Number of different languages to include within the plot
Value:
Returns a plot languages with the most number of students who
speak it