fkr makes pretend (fake) data that looks like it came from the Philippines – names, addresses, phone numbers, ages, job titles, and more – without using any real person’s information.
Why would you want “fake” data?
Every single value this package produces – every name, every address, every number – is made up on the spot. Nothing is looked up from a real database of real people.
A note on ID numbers. Some functions produce values formatted to look like Philippine government ID numbers (an SSS number, a TIN, a PhilSys number, and so on). These are entirely random digits arranged in the right pattern – they are not real ID numbers, they don’t belong to anyone, and they will not work if you try to use them anywhere official. They exist only so that test data looks complete.
If this is your first time, you’ll need R installed on your computer (see r-project.org). Once R is running, install fkr with:
Then, every time you want to use it, start your R session with:
Every function in this package starts with fkr_, so
they’re easy to spot and to search for. Let’s make one fake first
name:
That 1 tells the function “I want one
value.” Want five instead? Change the 1 to a
5:
That’s the pattern for everything in this package: the first
thing you tell a fkr_* function is always how many
fake values you want.
fkr_first_name(3)
#> [1] "Elaine" "Valiant" "Orion"
fkr_last_name(3)
#> [1] "Velasco" "Dela Cruz" "Dela Cruz"
fkr_full_name(3)
#> [1] "Valentina Espiritu" "Neil Dela Cruz" "Leonora Cunanan"
fkr_sex(3)
#> [1] "Male" "Male" "Male"
fkr_civil_status(3)
#> [1] "Single" "Single" "Single"
fkr_age(3)
#> [1] 15 10 3
fkr_birthday(3)
#> [1] "2025-03-28" "2002-12-11" "2021-06-18"fkr_email(3)
#> [1] "[email protected]" "[email protected]"
#> [3] "[email protected]"
fkr_mobile_number(3)
#> [1] "09911740237" "09986938433" "09195927871"
fkr_landline_number(3)
#> [1] "(054) 971 6406" "(043) 971 8009" "(045) 994 1968"fkr_region(3)
#> [1] "Region I (Ilocos Region)" "Region II (Cagayan Valley)"
#> [3] "Negros Island Region (NIR)"
fkr_province(3)
#> [1] "Nueva Ecija" "Davao del Norte" "Capiz"
fkr_city(3)
#> [1] "Legazpi City" "Dagupan City" "Iligan City"
fkr_barangay(3)
#> [1] "Pag-asa" "San Miguel" "Poblacion"
fkr_street_address(3)
#> [1] "530 Del Pilar Highway" "14 Rizal Highway" "961 Recto Road"Need a full, ready-made address (street, barangay, city, province, region, and ZIP code, all matching each other)? There’s a function for that too, and it gives you back a small table instead of a single value:
fkr_address(3)
#> street barangay city province
#> 1 44 Osmena Highway San Vicente Tabuk City Kalinga
#> 2 459 Shaw Boulevard Road Concepcion Koronadal City South Cotabato
#> 3 607 Del Pilar Street Santo Nino Tabuk City Kalinga
#> region zip
#> 1 Cordillera Administrative Region (CAR) 3800
#> 2 Region XII (SOCCSKSARGEN) 9506
#> 3 Cordillera Administrative Region (CAR) 3800As mentioned above, these are random digits in the right pattern – not real IDs.
fkr_sss_number(3)
#> [1] "45-2399799-3" "11-7751447-7" "15-0446348-7"
fkr_tin_number(3)
#> [1] "688-692-847-737" "772-139-002-415" "514-507-562-711"
fkr_philhealth_number(3)
#> [1] "17-404499200-8" "66-273299625-9" "34-973382722-1"
fkr_pagibig_number(3)
#> [1] "0165-5700-8474" "0472-8071-2401" "4851-2818-9493"
fkr_philsys_number(3)
#> [1] "5918-1642-2549-9234" "6031-6810-7962-9059" "3681-9273-4519-5174"fkr_company(3)
#> [1] "Mendoza & Garcia Construction Co."
#> [2] "Fernandez & Velasco Marketing Corp."
#> [3] "Mendoza & Ignacio Group of Companies Holdings, Inc."
fkr_job_title(3)
#> [1] "Software Developer" "Store Supervisor"
#> [3] "Municipal Administrator"
fkr_industry(3)
#> [1] "Real Estate" "Business Consulting" "Construction"
fkr_product(3)
#> [1] "Bottled Soy Sauce" "Coconut Vinegar" "Sinigang Mix"
fkr_price(3)
#> [1] "PHP 106.69" "PHP 51.19" "PHP 15.22"These aren’t Philippines-specific – they’re handy building blocks for any fake dataset.
fkr_num(5, min = 0, max = 100) # plain numbers, e.g. a score or a rating
#> [1] 3.96 80.66 67.72 11.87 4.05
fkr_int(5, min = 18, max = 65) # whole numbers, e.g. an age range
#> [1] 63 19 53 56 34
fkr_boolean(5) # TRUE / FALSE, e.g. "has a Facebook account?"
#> [1] TRUE FALSE TRUE FALSE FALSE
fkr_uuid(3) # a unique ID for each record
#> [1] "1e2ce15d-259c-4b39-9f03-4983c0f44147"
#> [2] "85f18c76-15d6-4d99-8174-cae9600b21d5"
#> [3] "9d9b12f7-13b9-4832-9689-3176ba5bf281"Two more worth a closer look:
fkr_multiple_response() pretends to be
a survey question where someone can pick more than one answer (a “select
all that apply” question):
fkr_multiple_response(5, values = c("Email", "Phone", "SMS"), sep = ", ")
#> [1] "Phone, SMS" "Email, Phone, SMS" "Email, SMS"
#> [4] "Email, Phone" "SMS"fkr_factor() creates a fake
category column, where each code has a friendlier label
attached – similar to how survey or statistics software lets you store
1/2 but display “Male”/“Female”:
fkr_factor(5, values = c(1, 2), labels = c("Male", "Female"))
#> [1] Male Female Male Male Male
#> Levels: Male FemaleYou can also attach a short description of the whole column (not each
value) using label:
So far we’ve made one column at a time. Most of the time, though, you want a whole table of fake data – like a spreadsheet with many columns and many rows, where each row is one pretend person or one pretend record.
That’s what the fkr() function is for. You give it:
n: how many rows (pretend people) you want, andspecs: a list that says, for each column, which
fkr_* function should fill it in.fkr(5, list(
first_name = fkr_first_name,
last_name = fkr_last_name,
sex = fkr_sex,
age = fkr_age,
date_of_birth = fkr_birthday,
mobile_number = fkr_mobile_number
))
#> first_name last_name sex age date_of_birth mobile_number
#> 1 Taylor De Castro Male 6 2020-03-15 09990148646
#> 2 Sophie Gomez Male 5 2021-08-03 09492362615
#> 3 Darwin Carlos Female 26 2000-01-29 09556728856
#> 4 Miranda Sanchez Male 51 1975-01-10 09277267504
#> 5 Ventana Santiago Male 61 1964-12-31 09482247608Notice that we wrote fkr_first_name, not
fkr_first_name() – no parentheses. We’re telling
fkr() which tool to use for that column; it takes
care of calling it the right number of times for you.
If a column’s generator gives back a whole mini-table of its own –
like fkr_address() does – fkr() automatically
spreads its pieces out into separate columns, named after the column you
asked for:
fkr(3, list(
name = fkr_full_name,
address = fkr_address
))
#> name address_street address_barangay address_city
#> 1 Lynette Mahinay 102 Marcos Highway Street Kaligayahan Mamburao
#> 2 Martha Mendoza 734 Katipunan Road Tibig Baguio City
#> 3 Toddy Dela Cruz 462 Legarda Road Poblacion Parañaque
#> address_province address_region address_zip
#> 1 Occidental Mindoro MIMAROPA Region 5106
#> 2 Benguet Cordillera Administrative Region (CAR) 2600
#> 3 Metro Manila National Capital Region (NCR) 1700Some generators accept extra settings. For example,
fkr_city() can be limited to one province. To use that
inside fkr(), wrap it in a small “recipe”:
fkr(5, list(
city_in_cebu = function(n) fkr_city(n, province = "Cebu")
))
#> city_in_cebu
#> 1 Mandaue City
#> 2 Cebu City
#> 3 Cebu City
#> 4 Cebu City
#> 5 Cebu CityRead function(n) fkr_city(n, province = "Cebu") as: “to
make this column, call fkr_city, asking for n
values, always from the province of Cebu.”
Sometimes a column’s value should depend on another column you
already made – for example, whether someone is a “Minor” or an “Adult”
depends on their age. Add a second ingredient,
data, to see the columns built so far:
If you ask for both an age column and a birthday column
in the same fkr() call, fkr is smart about it: it
makes sure the birthday it generates actually matches the age in that
same row. You don’t have to do anything extra – just ask for both, by
name, as shown below:
people <- fkr(5, list(
age = fkr_age,
date_of_birth = fkr_birthday
))
people
#> age date_of_birth
#> 1 38 1988-06-17
#> 2 8 2018-09-22
#> 3 10 2016-08-16
#> 4 14 2012-10-05
#> 5 13 2013-01-12(If you ever want them to be unrelated – unusual, but
possible – wrap one of them in function(n) ..., the same
trick shown above for “extra settings.” That tells fkr you’re taking
manual control of that column.)
Everything in this package is random by design – that’s the point of fake data! But sometimes you want to get the exact same fake data again, for example to write a tutorial where your readers see the same numbers you did.
Call fkr_seed() with any whole number right before
generating your data:
?fkr_address, to see
exactly what settings it accepts.