read.data.matrix: read.data.matrix

Description Usage Arguments Value Author(s) Examples

Description

This function allows you to import a csv into the correct data.matrix format for the madm package

Usage

1
read.data.matrix(path, header = TRUE)

Arguments

path,

an absolute path to the raw decision matrix in the 'read.data.matrix' format.

header,

Boolean, default to true, will flag the read.csv function with whether header columns are included or not.

Value

data.matrix format of a data.frame

Author(s)

Blake Conrad

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# IMPORTANT:
#  1. Abide the shape specifications listed below.
#  2. Make sure cost attributes have cost in their name. 
#  3. Make sure the weight column is explicitely labeled, 'weight'

#read.data.matrix("C:/Desktop/your.csv")

## Convert a standard import of:

#         name      x1  x2  x3Cost
# 1       weight    0.2 0.2 0.6
# 2 alternative1    0.5 0.5 0.5
# 3 alternative2    0.5 0.5 0.5
# 4 alternative3    0.5 0.5 0.5

# OR
# 
#         name      x1  x2  x3
#         benefit   +   +    -
# 1       weight    0.2 0.2 0.6
# 2 alternative1    0.5 0.5 0.5
# 3 alternative2    0.5 0.5 0.5
# 4 alternative3    0.5 0.5 0.5


# into (with rownames instead of a rownames column):

#               x1  x2  x3Cost
# weight       0.2 0.2 0.6
# alternative1 0.5 0.5 0.5
# alternative2 0.5 0.5 0.5
# alternative3 0.5 0.5 0.5

# OR

#                    x1  x2  x3
#        benefit     +   +    -
# 1       weight    0.2 0.2 0.6
# 2 alternative1    0.5 0.5 0.5
# 3 alternative2    0.5 0.5 0.5
# 4 alternative3    0.5 0.5 0.5
# Standard Decision Matrix Format (N+1)xD:

#               attribute1 attribute2 ... attributei ... attributeD
# weight     
# alternative1
# alternative2
# .
# .
# .
# alternativeN

conradbm/madmR documentation built on May 28, 2019, 4:35 p.m.