Learn R Programming

wakefield (version 0.3.6)

grade: Generate Random Vector of Grades

Description

grade - Generate a random normal vector of percent grades.

grade - Generate a random normal vector of letter grades.

grade - Generate a random normal vector of grade point averages (GPA; 0.0 - 4.0 scale).

Usage

grade(n, mean = 88, sd = 4, name = "Grade", digits = 1)

grade_letter(n, mean = 88, sd = 4, name = "Grade_Letter")

gpa(n, mean = 88, sd = 4, name = "GPA")

Arguments

n

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

mean

The mean value for the normal distribution to be drawn from.

sd

The standard deviation of the normal distribution to draw 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.

digits

Integer indicating the number of decimal places to be used. Negative values are allowed (see round).

Value

Returns a random normal vector of grade elements.

Details

The conversion between percent range, letter grade, and GPA is:

Percent Letter GPA
97-100 A+ 4.00
93-96 A 4.00
90-92 A- 3.67
87-89 B+ 3.33
83-86 B 3.00
80-82 B- 2.67
77-79 C+ 2.33
73-76 C 2.00
70-72 C- 1.67
67-69 D+ 1.33
63-66 D 1.00
60-62 D- 0.67

See Also

Other variable functions: age(), animal(), answer(), area(), car(), children(), coin(), color, date_stamp(), death(), dice(), dna(), dob(), dummy(), education(), employment(), eye(), grade_level(), 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 {
grade(10)
hist(grade(10000))
interval(grade, 5, n = 1000)

grade_letter(10)
barplot(table(grade_letter(10000)))

gpa(10)
hist(gpa(10000))
# }

Run the code above in your browser using DataLab