prolific_read_demog: Read and optionally merge demographics file from prolific...

prolific_read_demogR Documentation

Read and optionally merge demographics file from prolific academic

Description

prolific academic provides a demographics file. This reads it and merges with your data using PID and participant_id

Usage

prolific_read_demog(
  file,
  base = "",
  df = NULL,
  by.df = "PROLIFIC_PID",
  by.demog = "Participant.id",
  age = "age",
  sex = "Gender",
  vars = NULL,
  all.df = TRUE,
  all.demog = FALSE,
  verbose = FALSE
)

Arguments

file

Path to a file to read.

base

Optional path to folder, in which case 'file' is just filename.

df

Existing datafile to merge demographics into (optional)

by.df

The ID name in existing datafile (default = "PROLIFIC_PID"

by.demog

The ID name in the prolific demographics file (default = "Participant id" was by.demog)

age

Name of sex var in demographics file ("age")

sex

Name of sex var in demographics file ("Sex")

vars

Additional vars to keep from demographics file (WAS age & Sex)

all.df

Whether to keep all lines of df (default = TRUE)

all.demog

Whether to keep all lines (people) in the demographics file (default = FALSE)

verbose

Print variable names found in the file.

Value

  • [data.frame]

References

See Also

  • prolific_check_ID(), prolific_anonymize(), umx_merge_randomized_columns()

Other Data Functions: noNAs(), prolific_anonymize(), prolific_check_ID(), umxFactor(), umxHetCor(), umx_as_numeric(), umx_cont_2_quantiles(), umx_lower2full(), umx_make_MR_data(), umx_make_TwinData(), umx_make_fake_data(), umx_make_raw_from_cov(), umx_merge_randomized_columns(), umx_polychoric(), umx_polypairwise(), umx_polytriowise(), umx_read_lower(), umx_rename(), umx_reorder(), umx_score_scale(), umx_select_valid(), umx_stack(), umx_strings2numeric(), umx

Examples

## Not run: 
fp = "~/Desktop/prolific_export_5f20c3e662e3b6407dcd37a5.csv"
df = prolific_read_demog(fp, sex = "Gender", age = "Age", df = df)
tmp = prolific_read_demog(fp, by.df = "PROLIFIC_PID", vars=c("EthnicitySimplified"))

## End(Not run)

umx documentation built on Nov. 17, 2023, 1:07 a.m.