encode_as_num_mat {eHDPrep}R Documentation

Convert data frame to numeric matrix

Description

Converts all columns to numeric and uses the row identifier column (id_var) as row names.

Usage

encode_as_num_mat(data, id_var)

Arguments

data

A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

id_var

An unquoted expression which corresponds to a variable in data which identifies each row.

Value

Numeric matrix with id_var values as row names

Examples

require(dplyr)
require(magrittr)
mtcars %>%
  dplyr::as_tibble(rownames = "id") %>%
  encode_as_num_mat(id)

[Package eHDPrep version 1.2.1 Index]