Learn R Programming

tna (version 1.1.0)

import_onehot: Import One-Hot Data and Create a Co-Occurrence Network Model

Description

Import One-Hot Data and Create a Co-Occurrence Network Model

Usage

import_onehot(data, cols, window = 1L)

Value

A tna object for the co-occurrence model.

Arguments

data

A data.frame in wide format.

cols

An expression giving a tidy selection of column names to be transformed into long format (actions). This can be a vector of column names (e.g., c(feature1, feature2)) or a range specified as feature1:feature6 (without quotes) to include all columns from 'feature1' to 'feature6' in the order they appear in the data frame. For more information on tidy selections, see dplyr::select().

window

An integer specifying the size of the window for sequence grouping. Default is 1 (each row is a separate window). Can also be a character string giving a name of the column in data whose levels define the windows.

See Also

Other data: import_data(), prepare_data(), print.tna_data(), simulate.tna()

Examples

Run this code
d <- data.frame(
  window = gl(100, 5),
  feature1 = rbinom(500, 1, prob = 0.33),
  feature2 = rbinom(500, 1, prob = 0.25),
  feature3 = rbinom(500, 1, prob = 0.50)
)
model <- import_onehot(d, feature1:feature3, window = "window")

Run the code above in your browser using DataLab