Rev 93 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
R Under development (unstable) (2019-07-31 r76909) -- "Unsuffered Consequences"Copyright (C) 2019 The R Foundation for Statistical ComputingPlatform: x86_64-pc-linux-gnu (64-bit)R is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under certain conditions.Type 'license()' or 'licence()' for distribution details.R is a collaborative project with many contributors.Type 'contributors()' for more information and'citation()' on how to cite R or R packages in publications.Type 'demo()' for some demos, 'help()' for on-line help, or'help.start()' for an HTML browser interface to help.Type 'q()' to quit R.> library(foreign)> lookup.xport("Alfalfa.xpt")$SPEC$SPEC$headpad[1] 1360$SPEC$type[1] "character" "numeric" "numeric" "numeric" "numeric" "numeric"$SPEC$width[1] 8 8 8 8 8 8$SPEC$index[1] 1 2 3 4 5 6$SPEC$position[1] 0 8 16 24 32 40$SPEC$name[1] "POP" "SAMPLE" "REP" "SEEDWT" "HARV1" "HARV2"$SPEC$label[1] "" "" "" "" "" ""$SPEC$format[1] "" "" "" "" "" ""$SPEC$sexptype[1] 16 14 14 14 14 14$SPEC$tailpad[1] 0$SPEC$length[1] 40> Alfalfa <- read.xport("Alfalfa.xpt", stringsAsFactors = TRUE)> summary(Alfalfa)POP SAMPLE REP SEEDWT HARV1MAX:20 Min. :0.0 Min. :1.00 Min. :35.00 Min. :120.6min:20 1st Qu.:2.0 1st Qu.:1.75 1st Qu.:47.75 1st Qu.:148.3Median :4.5 Median :2.50 Median :59.00 Median :165.8Mean :4.5 Mean :2.50 Mean :56.08 Mean :163.03rd Qu.:7.0 3rd Qu.:3.25 3rd Qu.:62.25 3rd Qu.:176.4Max. :9.0 Max. :4.00 Max. :75.00 Max. :193.4HARV2Min. :129.11st Qu.:150.6Median :163.2Mean :167.13rd Qu.:179.6Max. :235.3> ## test data provided by FRohde@birchdavis.com> lookup.xport("test.xpt")$TEST$TEST$headpad[1] 800$TEST$type[1] "numeric" "numeric"$TEST$width[1] 8 8$TEST$index[1] 1 2$TEST$position[1] 0 8$TEST$name[1] "I" "K"$TEST$label[1] "" ""$TEST$format[1] "" ""$TEST$sexptype[1] 14 14$TEST$tailpad[1] 48$TEST$length[1] 12> testdata <- read.xport("test.xpt")> summary(testdata)I KMin. :1.00 Min. :11st Qu.:1.75 1st Qu.:1Median :2.50 Median :2Mean :2.50 Mean :23rd Qu.:3.25 3rd Qu.:3Max. :4.00 Max. :3> q()> proc.time()user system elapsed0.107 0.024 0.121