edsurveyTable2pdf: PDF File From an edsurveyTable

View source: R/edsurveyTable2pdf.R

edsurveyTable2pdfR Documentation

PDF File From an edsurveyTable

Description

Produces the LaTeX code and compiles to a PDF file from the edsurveyTable results.

Usage

edsurveyTable2pdf(
  data,
  formula,
  caption = NULL,
  filename = "",
  toCSV = "",
  returnMeans = TRUE,
  estDigits = 2,
  seDigits = 3
)

Arguments

data

the result of a call to edsurveyTable

formula

a formula of the form LHS ~ RHS to cast the edsurveyTable results from long format to wide format. This formula takes the form LHS ~ RHS (e.g., var1 + var2 ~ var3). The order of the entries in the formula is essential.

caption

character vector of length one or two containing the table's caption or title. If the length is two, the second item is the “short caption” used when LaTeX generates a List of Tables. Set to NULL to suppress the caption. Default value is NULL.

filename

a character string containing filenames and paths. By default (filename = ""), table will be saved in the working directory (getwd()). Use filename = "CONSOLE" to print LaTeX code in R console without generating a PDF file.

toCSV

a character string containing filenames and paths of .csv table output. "" indicates no .csv output. toCSV is independent to filename, so both a csv file and PDF file would be generated if both filename and toCSV were specified.

returnMeans

a logical value set to TRUE (the default) to generate a PDF with the MEAN and SE(MEAN). It is set to FALSE to generate a PDF with the PCT and SE(PCT). See Value in edsurveyTable.

estDigits

an integer indicating the number of decimal places to be used for estimates. Negative values are allowed. See Details.

seDigits

an integer indicating the number of decimal places to be used for standard errors. Negative values are allowed.

Details

Rounding to a negative number of digits means rounding to a power of 10, so, for example, estDigits = -2 rounds estimates to the nearest hundred.

Note

For more details, see the vignette titled Producing LaTeX Tables From edsurveyTable Results With edsurveyTable2pdf.

Author(s)

Huade Huo

Examples

## Not run: 
  # read in the example data (generated, not real student data)
  sdf <- readNAEP(path=system.file("extdata/data", "M36NT2PM.dat", package="NAEPprimer"))
  
  # create a table with composite scores by dsex and b017451
  est1 <- edsurveyTable(formula=composite ~ dsex + b017451, data=sdf)
  
  # create a table with csv output
  edsurveyTable2pdf(data=est1, 
                    formula=b017451~dsex, 
                    toCSV="C:/example table.csv",
                    filename="C:/example table.pdf",
                    returnMeans=FALSE)
  
  # create a pdf file using the default subject scale or subscale
  # and keep two digits for estimates and three digits for SE after decimal point
  edsurveyTable2pdf(data=est1, formula=b017451~dsex, 
                    returnMeans=TRUE, estDigits=2, seDigits=3)
  
  # create a pdf file using the percentage of students at the 
  # aggregation level specified by \code{pctAggregationLevel}
  # output will be saved as "C:/example table.pdf"
  edsurveyTable2pdf(data=est1, 
                    formula=b017451~dsex, 
                    filename="C:/example table.pdf",
                    returnMeans=FALSE)

## End(Not run)

EdSurvey documentation built on June 27, 2024, 5:10 p.m.