Learn R Programming

ribiosUtils (version 1.5-6)

asNumMatrix: Convert string-valued data frame or matrix into a numeric matrix

Description

Convert string-valued data frame or matrix into a numeric matrix

Usage

asNumMatrix(x)

Arguments

x

A data.frame or matrix, most likely with string values

Value

A numeric matrix with the same dimension

Examples

Run this code
# NOT RUN {
testDf <- data.frame(a=c("2.34", "4.55"), b=c("7.33", "9.10"))
asNumMatrix(testDf)

testMatrix <- matrix(c("2.34", "4.55", "9E-3","-2.44", "7.33", "9.10"), nrow=2)
asNumMatrix(testMatrix)

# }

Run the code above in your browser using DataLab