Learn R Programming

EdSurvey (version 2.2.3)

downloadPISA: Download and Unzips PISA Files

Description

Uses a connection to download PISA data to a computer. Data come from the OECD website.

Usage

downloadPISA(root, years = c(2000, 2003, 2006, 2009, 2012),
  database = c("INT", "CBA", "FIN"), cache = FALSE, verbose = TRUE)

Arguments

root

a character string indicating the directory where the PISA data should be stored. Files are placed in a folder named PISA/[year].

years

an integer vector of the assessment years to download. Valid years are 2000, 2003, 2006, 2009, and 2012.

database

a character vector to indicate which database to download from. For 2012, three databases are available (INT = International, CBA = Computer-Based Assessment, and FIN = Financial Literacy). Defaults to INT.

cache

a logical value set to process and cache the text (.txt) version of files. This takes a very long time but saves time for future uses of the data. Default value is FALSE.

verbose

a logical value to either print or suppress status message output. The default value is TRUE.

Details

The function uses download.file to download files from provided URLs. Some machines might require a different user agent in HTPP(S) requests. If the downloading gives an error or behaves unexpectedly (for example, a zip file cannot be unzipped or a data file is significantly smaller than expected), users can toggle HTPPUserAgent options to find one that works for their machines. One common alternative option is

options(HTTPUserAgent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0").

See Also

readPISA, download.file, options

Examples

Run this code
# NOT RUN {
# Download PISA 2012 data (for all three databases)
downloadPISA(years = 2012, database = c("INT","CBA","FIN"), root="C:/")

# Download PISA 2009 and 2012 data (International Database only) 
# to C:/PISA/2009 and C:/PISA/2012 folder respectively
downloadPISA(years = c(2009,2012), root="C:/")  
# }

Run the code above in your browser using DataLab