Last data update: 2014.03.03
|
R: Define Data Set, Reverse Items and Alternate Orders
Define Data Set, Reverse Items and Alternate Orders
Description
Construct a ScaleData object, in order to hold data, item content,
administration order(s), reverse items and item column names.
Usage
Scale(data, orders, orders_id, reverse, items, col_names)
Arguments
data |
A data.frame with participants as rows and items as columns.
|
orders |
A list of the various orders used for reordering the questionnaire administration, if any. Each order is an integer vector.
|
orders_id |
An integer vector identifying which order of the questionnaire each participant received.
|
reverse |
In the original order, which of the items need to be reversed.
|
items |
An optional character vector containing the item statements.
|
col_names |
An optional character vector of the desired column names of the items, in the original order.
|
Value
A ScaleData object, with the above arguments named, in order
to be passed on to the PreProc() function.
Author(s)
Nikolaos Giallousis, psierevn@gmail.com
Examples
data(Depression98)
depressionScale <- Scale(data=Depression98,
orders=list(
c(16,19,11,9,1,17,5,18,4,8,2,12,
20,10,14,6,3,13,15,7),
c(1,18,4,15,7,8,3,14,20,6,19,16,
12,5,10,13,2,17,11,9)),
orders_id=c(
rep(1, 49),
rep(2, 49)),
reverse=c(3,4,13,14,18,20),
col_names= paste('q', 1:20, sep=''))
str(depressionScale)
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(Scale)
Loading required package: psych
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
Attaching package: 'ggplot2'
The following objects are masked from 'package:psych':
%+%, alpha
Attaching package: 'Hmisc'
The following object is masked from 'package:psych':
describe
The following objects are masked from 'package:base':
format.pval, round.POSIXt, trunc.POSIXt, units
Loading required package: MASS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Scale/ScaleData.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Scale
> ### Title: Define Data Set, Reverse Items and Alternate Orders
> ### Aliases: ScaleData Scale
> ### Keywords: survey multivariate
>
> ### ** Examples
>
> data(Depression98)
> depressionScale <- Scale(data=Depression98,
+ orders=list(
+ c(16,19,11,9,1,17,5,18,4,8,2,12,
+ 20,10,14,6,3,13,15,7),
+ c(1,18,4,15,7,8,3,14,20,6,19,16,
+ 12,5,10,13,2,17,11,9)),
+ orders_id=c(
+ rep(1, 49),
+ rep(2, 49)),
+ reverse=c(3,4,13,14,18,20),
+ col_names= paste('q', 1:20, sep=''))
> str(depressionScale)
List of 6
$ data :'data.frame': 98 obs. of 20 variables:
..$ V1 : int [1:98] 2 2 5 2 3 3 3 1 2 2 ...
..$ V2 : int [1:98] 2 2 4 4 4 3 2 1 4 2 ...
..$ V3 : int [1:98] 1 3 3 2 1 1 2 1 1 1 ...
..$ V4 : int [1:98] 2 3 3 2 3 3 5 1 4 2 ...
..$ V5 : int [1:98] 2 4 1 2 4 2 4 1 5 3 ...
..$ V6 : int [1:98] 4 2 4 3 1 4 4 5 5 4 ...
..$ V7 : int [1:98] 2 3 2 2 2 1 3 5 3 2 ...
..$ V8 : int [1:98] 2 2 4 4 4 3 1 5 4 4 ...
..$ V9 : int [1:98] 2 2 4 4 4 4 3 5 4 4 ...
..$ V10: int [1:98] 2 4 1 2 1 1 2 1 2 2 ...
..$ V11: int [1:98] 2 3 3 1 1 1 3 1 1 2 ...
..$ V12: int [1:98] 2 4 3 3 3 1 2 1 3 2 ...
..$ V13: int [1:98] 4 2 4 2 4 4 4 5 4 4 ...
..$ V14: int [1:98] 4 4 4 1 4 1 3 5 4 2 ...
..$ V15: int [1:98] 4 2 3 2 4 5 4 5 2 4 ...
..$ V16: int [1:98] 4 3 5 4 4 4 4 4 4 4 ...
..$ V17: int [1:98] 2 2 1 5 2 5 2 1 4 4 ...
..$ V18: int [1:98] 2 4 3 4 NA 1 4 5 4 3 ...
..$ V19: int [1:98] 4 2 5 5 4 2 5 1 4 4 ...
..$ V20: int [1:98] 4 2 3 3 4 3 4 1 4 3 ...
$ orders :List of 2
..$ : num [1:20] 16 19 11 9 1 17 5 18 4 8 ...
..$ : num [1:20] 1 18 4 15 7 8 3 14 20 6 ...
$ orders_id: num [1:98] 1 1 1 1 1 1 1 1 1 1 ...
$ reverse : num [1:6] 3 4 13 14 18 20
$ items : chr(0)
$ col_names: chr [1:20] "q1" "q2" "q3" "q4" ...
- attr(*, "class")= chr "ScaleData"
>
>
>
>
>
> dev.off()
null device
1
>
|