Learn R Programming

EdSurvey (version 2.2.3)

readPISA: Connect to PISA Data

Description

Opens a connection to a PISA data file and returns an edsurvey.data.frame with information about the file and data.

Usage

readPISA(path, database = "INT", countries, cognitive = "score",
  forceReread = FALSE, verbose = TRUE)

Arguments

path

a character vector to the full directory path(s) to the PISA extracted fixed-width files and SPSS control files (.txt)

database

a character to indicate a selected database. Must be one of INT (general database that most people use), CBA (computer-based database in PISA 2012 only), or FIN (financial literacy database in PISA 2012 only). Defaults to INT.

countries

a character vector of the country/countries to include using the three-digit ISO country code. A list of country codes can be found in the PISA codebook or https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes. If files are downloaded using downloadPISA, a country dictionary text file can be found in the filepath.

cognitive

one of none, score, or response. Default is score. The PISA database often has three student files: student questionnaire, cognitive item response, and scored cognitive item response. The first file is used as the main student file with student background information. Users can choose whether to merge score or response data into the main file or not (if none).

forceReread

a logical value to force rereading of all processed data. Defaults to FALSE. Setting forceReread to be TRUE will cause PISA data to be reread and increase processing time.

verbose

a logical value that will determine if you want verbose output while the function is running to indicate the progress. Defaults to TRUE.

Value

an edsurvey.data.frame for a single specified country or an edsurvey.data.frame.list if multiple countries specified

Details

Reads in the unzipped files downloaded from the PISA database using the OECD Repository (http://www.oecd.org/pisa/). Users can use downloadPISA to download all required files. Student questionnaire files (with weights and plausible values) are used as main files, which are then merged with cognitive, school, and parent files (if available).

The average first-time processing time for one year and one database for all countries is 10--15 minutes. If forceReread is set to be FALSE, the next time this function is called will only take 5--10 seconds.

References

Organisation for Economic Co-operation and Development. (2017). PISA 2015 technical report. Paris, France: Author. Retrieved from http://www.oecd.org/pisa/data/2015-technical-report/

See Also

getData and downloadPISA

Examples

Run this code
# NOT RUN {
# The following call returns an edsurvey.data.frame to 
# PISA 2012 International Database for Singapore
sgp2012 <- readPISA(path = "C:/PISA/2012", database = "INT", countries = "sgp")

# Extract a data.frame with a few variables
gg <- getData(sgp2012, c("cnt","read","w_fstuwt"))  
head(gg)

# Conduct a preliminary analysis on the edsurvey.data.frame
edsurveyTable(read ~ st04q01 + st20q01, data = sgp2012)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab