dot-convertData: Convert a matrix or data frame to numeric or integer for...

Description Usage Arguments Value Examples

Description

Primarily an internal utility function, for prepareMplusData.

Usage

1
.convertData(df, dummyCode = NULL)

Arguments

df

A matrix or data frame

Value

An error if it cannot be converted or a matrix or data frame with all variables converted to numeric or integer classes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## Not run: 
df1 <- df2 <- df3 <- df4 <- mtcars

df2$cyl <- factor(df2$cyl)
df2$am <- as.logical(df2$am)

df3$mpg <- as.character(df3$mpg)

df4$vs <- as.Date(df4$vs, origin = "1989-01-01")

df5 <- as.matrix(cars)

df6 <- matrix(c(TRUE, TRUE, FALSE, FALSE), ncol = 2)

df7 <- as.list(mtcars)


MplusAutomation:::.convertData(df1)

MplusAutomation:::.convertData(df2)

MplusAutomation:::.convertData(df3)

MplusAutomation:::.convertData(df4)

MplusAutomation:::.convertData(df5)

MplusAutomation:::.convertData(df6)

MplusAutomation:::.convertData(df7)

rm(df1, df2, df3, df4, df5, df6, df7)

## End(Not run)

MplusAutomation documentation built on July 1, 2021, 9:07 a.m.