wakefield (version 0.3.3)

religion: Generate Random Vector of Religions

Description

Generate a random vector of religion.

Usage

religion(n, x = c("Christian", "Muslim", "None", "Hindu", "Buddhist", "Folk",
  "Other", "Jewish"), prob = c(0.31477, 0.23163, 0.16323, 0.14985, 0.07083,
  0.05882, 0.00859, 0.00227), name = "Religion")

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 factor vector of religion elements.

Details

The religion and probabilities used match approximate world religion make-up (from Pew Research Center). The default make up is:

Religion N Percent
Christian 2,173,260,000 31.48 %
Muslim 1,599,280,000 23.16 %
None 1,127,000,000 16.32 %
Hindu 1,034,620,000 14.99 %
Buddhist 489,030,000 7.08 %
Folk 406,140,000 5.88 %
Other 59,330,000 .86 %
Jewish 15,670,000 .23 %

References

http://www.pewforum.org/2012/12/18/table-religious-composition-by-country-in-numbers

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, grade, group, hair, height, income, internet_browser, iq, language, level, likert, lorem_ipsum, marital, military, month, name, normal, political, race, sat, sentence, sex_inclusive, sex, smokes, speed, state, string, upper, valid, year, zip_code

Examples

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

Run the code above in your browser using DataLab