Produces the LaTeX code and compiles to a PDF file from the edsurveyTable
results.
edsurveyTable2pdf(
data,
formula,
caption = NULL,
filename = "",
toCSV = "",
returnMeans = TRUE,
estDigits = 2,
seDigits = 3
)
the result of a call to edsurveyTable
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.
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
.
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.
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.
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
.
an integer indicating the number of decimal places to be used for estimates. Negative values are allowed. See Details.
an integer indicating the number of decimal places to be used for standard errors. Negative values are allowed.
Huade Huo
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.
if (FALSE) {
# 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)
}
Run the code above in your browser using DataLab