Last data update: 2014.03.03

R: Summarize variable information
var_viewR Documentation

Summarize variable information

Description

Creates a table with the name, the description, the value labels and the format for each variable in the data frame. It is similar to the variable view shown in the SPSS.

Usage

var_view(x)

Arguments

x

The data frame whose variables we want to summarize.

Value

A data frame containing the specified summary.

Note

This function was built in order to summarize imported SPSS labelled data sets using spss_import, but it can also work with other labelled data sets.

See Also

spss_import

Examples

require(ImportExport)
a<- 1:10
b<-rep("b",times=10)
c<-rep(1:2,each=5)
x<-data.frame(a,b,c)
attr(x$a,"label")<- "descr1"
attr(x$b,"label")<- NULL
attr(x$c,"label")<- "descr3"
attr(x$c,"value.labels")<-list("1"="Yes","2"="No")
var_view(x)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: 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(ImportExport)
Loading required package: xlsx
Loading required package: rJava
Loading required package: xlsxjars
Loading required package: gdata
gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.

gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.

Attaching package: 'gdata'

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following object is masked from 'package:gdata':

    combine

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

Loading required package: chron
Loading required package: RODBC
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ImportExport/var_view.Rd_%03d_medium.png", width=480, height=480)
> ### Name: var_view
> ### Title: Summarize variable information
> ### Aliases: var_view
> ### Keywords: value.labels labels
> 
> ### ** Examples
> 
> require(ImportExport)
> a<- 1:10
> b<-rep("b",times=10)
> c<-rep(1:2,each=5)
> x<-data.frame(a,b,c)
> attr(x$a,"label")<- "descr1"
> attr(x$b,"label")<- NULL
> attr(x$c,"label")<- "descr3"
> attr(x$c,"value.labels")<-list("1"="Yes","2"="No")
> var_view(x)
  varname    descr value_labels formats
1       a   descr1              integer
2       b No descr               factor
3       c   descr3   1=Yes/2=No integer
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>