library
(jsonlite)
generate_id <-
function
()
paste0
(
sample
(
c
(
letters
,
LETTERS
, 0:9), 10,
replace=
TRUE
),
collapse=
""
)
first_names <-
c
(
"John"
,
"Jane"
,
"Michael"
,
"Emily"
,
"William"
,
"Ashley"
,
"David"
,
"Jessica"
,
"Andrew"
,
"Jennifer"
,
"Matthew"
,
"Sarah"
,
"Daniel"
,
"Amanda"
,
"Christopher"
,
"Elizabeth"
,
"Nicholas"
,
"Megan"
,
"Robert"
,
"Lauren"
,
"Joseph"
,
"Ava"
,
"Jacob"
,
"Sophia"
,
"Jonathan"
,
"Natalie"
,
"Ryan"
,
"Madison"
,
"Adam"
,
"Chloe"
)
last_names <-
c
(
"Smith"
,
"Johnson"
,
"Williams"
,
"Jones"
,
"Brown"
,
"Davis"
,
"Miller"
,
"Wilson"
,
"Moore"
,
"Taylor"
,
"Anderson"
,
"Thomas"
,
"Jackson"
,
"White"
,
"Harris"
,
"Martin"
,
"Thompson"
,
"Garcia"
,
"Martinez"
,
"Robinson"
,
"Clark"
,
"Rodriguez"
,
"Lewis"
,
"Lee"
,
"Walker"
,
"Hall"
,
"Allen"
,
"King"
,
"Wright"
,
"Scott"
)
qualifications <-
c
(
"Primary Education"
,
"Secondary Education"
,
"High School"
,
"Undergraduate"
,
"Postgraduate"
)
df <-
data.frame
(ID =
sapply
(1:1000000,
function
(i)
generate_id
()),
First_Name =
sample
(first_names,
1000000, replace =
TRUE
),
Last_Name =
sample
(last_names,
1000000, replace =
TRUE
),
Age =
sample
(18:30, 1000000,
replace =
TRUE
),
Highest_qualification =
sample
(qualifications, 1000000,
replace =
TRUE
),
stringsAsFactors =
FALSE
)
write_json
(df,
"people.json"
)