write.px | R Documentation |
This function writes an object of class px
to a PC-Axis file
write.px(obj.px, filename, heading = NULL, stub = NULL, keys = NULL , write.na = FALSE, write.zero = FALSE, fileEncoding = "ISO-8859-1")
obj.px |
The name of a object of class |
filename |
The name of the PC-Axis file to create |
heading |
An optional character vector with the names of variables in the HEADING part of the output file |
stub |
An optional character vector with the names of the variables in the STUB part of the output file |
keys |
An optional character vector indicating the variables used as keys |
write.na |
Whether to write rows with NA values (if keys are used) |
write.zero |
Whetehr to write rows with 0 values (if keys are used) |
fileEncoding |
A character string describing the encoding to use in px file (see |
The function can write either regular files or files with KEYS.
For regular files, by default, the output file will have a single variable in the HEADING part of the file (columns in the matrix). It
is possible to override the default by providing the heading
and stub
parameters. These are optional, non-overlapping,
exhaustive character vectors of names of variables in the output matrix.
It is possible to write files with KEYS which could help reduce the final file size for large and sparse datasets. In such case, it
is possible to indicate whether to write rows with all values equal to 0 or NA or not (via arguments write.zero
and ·write.na
).
Francisco J. Viciana Fernández, Oscar Perpiñan Lamigueiro, Carlos J. Gil Bellosta
https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf
read.px
,
as.data.frame.px
,
as.array.px
iconv
opx1 <- read.px(system.file( "extdata", "example.px", package = "pxR")) ## Not run: write.px(opx1, file = "opx.px") write.px(opx1, file = "opx.px", heading = c("sexo", "edad"), stub = "municipios") write.px(opx1, filename = "opx.px", keys = c("municipios","edad")) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.