Ramakrishna S
Ramakrishna S

Reputation: 437

characters in Matrix column

Can any one suggest how to remove quotes around all numbers, and around "C" and "?".

library(QCA)
cbind(createMatrix(c(2,2,2)), c("?", 1, 1, "?", "C", 0, 0, "?"))
#>      [,1] [,2] [,3] [,4]
#> [1,] "0"  "0"  "0"  "?" 
#> [2,] "0"  "0"  "1"  "1" 
#> [3,] "0"  "1"  "0"  "1" 
#> [4,] "0"  "1"  "1"  "?" 
#> [5,] "1"  "0"  "0"  "C" 
#> [6,] "1"  "0"  "1"  "0" 
#> [7,] "1"  "1"  "0"  "0" 
#> [8,] "1"  "1"  "1"  "?"

Upvotes: 1

Views: 120

Answers (1)

TarJae
TarJae

Reputation: 79077

You could use noquote()

library(QCA)
dm <- cbind(createMatrix(c(2,2,2)), c("?", 1, 1, "?", "C", 0, 0, "?"))
dm <- noquote(dm)
dm

Output:

     [,1] [,2] [,3] [,4]
[1,] 0    0    0    ?   
[2,] 0    0    1    1   
[3,] 0    1    0    1   
[4,] 0    1    1    ?   
[5,] 1    0    0    C   
[6,] 1    0    1    0   
[7,] 1    1    0    0   
[8,] 1    1    1    ?  

Upvotes: 3

Related Questions