df_to_comb_matrix: Function to convert sepcific columns of a dataframe to a...

Description Usage Arguments Value Note Examples

View source: R/df_to_comb_matrix.R

Description

Function to convert sepcific columns of a dataframe to a named matrix with value

Usage

1
2
3
4
5
6
7
df_to_comb_matrix(
  input.df = data.frame(),
  col.margin = 1,
  row.margin = 2,
  value.margin = 3,
  fill = NA
)

Arguments

input.df

The dataframe contains needed columns

col.margin

The index of inputed dataframe's column to be the colname

row.margin

The index of inputed dataframe's column to be the rowname

value.margin

The index of inputed dataframe's column to be the value

fill

The filled in value when no value of a pair is noticed

Value

A names matrix with values

Note

The value of fill will be filled in if no value of a pair is noticed

Examples

1
2
3
4
5
## Not run: 
  A <- data.frame(x = c('a', 'b', 'c'), y = c('A', 'B', 'c'), v = c(3:5))
  df_to_comb_matrix(A, col.margin = 2, row.margin = 1, value.margin = 3)

## End(Not run)

Ronlee12355/dfbmd documentation built on Sept. 23, 2020, 10:32 a.m.