Learn R Programming

pxR (version 0.42.7)

read.px: Reads a PC-Axis file

Description

This function reads a PC-AXIS file (a text file with certain format) and creates an object of the class px.

Usage

read.px(filename, encoding = NULL,
        na.strings = c('"."', '".."', '"..."', '"...."', '"....."', '"......"',
                       '":"'))

Value

An object of the class px, which is essentially a list comprising the fields of a PC-AXIS file (see references for details).

Arguments

filename

The name of the PC-Axis file to read

encoding

A character string describing the current encoding; see the Details section

na.strings

A character to be interpreted as missing value in the DATA field of the PC-AXIS file. The chapter 4 of the second reference provides details about the dot codes used in the PC-AXIS format.

Author

Carlos J. Gil Bellosta, Oscar Perpiñan Lamigueiro, Francisco J. Viciana Fernández

Details

This function reads data files in the PC-Axis format. The format is described in the two documents in the reference section.

According to them, null values can be encoded using ".", "..", "...", or "....".

Also, the documentation is not very specific concerning the actual encoding to be expected in PC-Axis files. It is however quite safe to assume that they will be encoded using some "latin1" variant. The alternative value for the encoding argument would be "utf-8".

References

https://www.scb.se/globalassets/vara-tjanster/px-programmen/px-file_format_specification_2013.pdf https://tilastokeskus.fi/tup/pcaxis/tiedostomuoto2006_laaja_en.pdf

See Also

as.data.frame.px, as.array.px iconv

Examples

Run this code

my.px.object <- read.px(system.file("extdata", "example.px",
                        package = "pxR") )
my.px.data   <-  as.data.frame( my.px.object )

Run the code above in your browser using DataLab