Learn R Programming

wakefield (version 0.3.6)

education: Generate Random Vector of Educational Attainment Level

Description

Generate a random vector of educational attainment level.

Usage

education(
  n,
  x = c("No Schooling Completed", "Nursery School to 8th Grade",
    "9th Grade to 12th Grade, No Diploma", "Regular High School Diploma",
    "GED or Alternative Credential", "Some College, Less than 1 Year",
    "Some College, 1 or More Years, No Degree", "Associate's Degree",
    "Bachelor's Degree", "Master's Degree", "Professional School Degree",
    "Doctorate Degree"),
  prob = c(0.013, 0.05, 0.085, 0.246, 0.039, 0.064, 0.15, 0.075, 0.176, 0.072, 0.019,
    0.012),
  name = "Education"
)

Arguments

n

The number elements to generate. This can be globally set within the environment of r_data_frame or r_list.

x

A vector of elements to chose from.

prob

A vector of probabilities to chose from.

name

The name to assign to the output vector's varname attribute. This is used to auto assign names to the column/vector name when used inside of r_data_frame or r_list.

Value

Returns a random vector of educational attainment level elements.

Details

The educational attainments and probabilities used match approximate U.S. educational attainment make-up (http://www.census.gov):

Highest Attainment Percent
No Schooling Completed 1.3 %
Nursery School to 8th Grade 5 %
9th Grade to 12th Grade, No Diploma 8.5 %
Regular High School Diploma 24.6 %
GED or Alternative Credential 3.9 %
Some College, Less than 1 Year 6.4 %
Some College, 1 or More Years, No Degree 15 %
Associate's Degree 7.5 %
Bachelor's Degree 17.6 %
Master's Degree 7.2 %
Professional School Degree 1.9 %
Doctorate Degree 1.2 %

References

http://www.census.gov

See Also

Other variable functions: age(), animal(), answer(), area(), car(), children(), coin(), color, date_stamp(), death(), dice(), dna(), dob(), dummy(), employment(), eye(), grade_level(), grade(), group(), hair(), height(), income(), internet_browser(), iq(), language, level(), likert(), lorem_ipsum(), marital(), military(), month(), name, normal(), political(), race(), religion(), sat(), sentence(), sex_inclusive(), sex(), smokes(), speed(), state(), string(), upper(), valid(), year(), zip_code()

Examples

Run this code
# NOT RUN {
education(10)
pie(table(education(10000)))
# }

Run the code above in your browser using DataLab