rehshape: Transform processed remify objects to different formats

View source: R/rehshape.R

rehshapeR Documentation

Transform processed remify objects to different formats

Description

A function that transforms a remify object into one of the possible formats that suit external packages. The function can convert, at the moment, the data structure from an object of class remify to a data structure required by the function relevent::rem() or by the function relevent::rem.dyad() from the 'relevent' package (Butts, C.T. 2023).

Usage

rehshape(
  data,
  output_format = c("relevent-rem", "relevent-rem.dyad"),
  ncores = 1L,
  optional_arguments = NULL
)

Arguments

data

an object of class 'remify' (see function remify::remify()).

output_format

a character indicating the output format which the input data has to be converted to. It can assume two values: "relevent-rem" , "relevent-rem.dyad". Default value is "relevent-rem".

ncores

number of cores used to parallelize internal algorithms

optional_arguments

vector of arguments names from relevent::rem or relevent::rem.dyad() that the user might want to process and have in the output object of rehshape (e.g., the pre-computed structures required by relevent::rem.dyad)

Value

an object of class specified in the output_format argument. The output class object 'relevent-rem' contains a list of objects named after the arguments of the function relevent::rem(): 'eventlist' (mandatory), 'supplist' (optional), 'timing'(mandatory). The output class object 'relevent-rem.dyad' contains a list of objects named after the arguments of the function relevent::rem.dyad(): 'edgelist' (mandatory), 'n' (mandatory), 'ordinal'(optional).

Examples


# processing the random network 'randomREH'
library(remify)
data(randomREH)
reh <- remify(edgelist = randomREH$edgelist,
              model = "tie",
              riskset = "manual",
              omit_dyad = randomREH$omit_dyad)

# convert 'remify' object to output_format = "relevent-rem"
relevent_rem_obj <- rehshape(data = reh, output_format = "relevent-rem")

str(relevent_rem_obj) 

# convert 'remify' object to output_format = "relevent-rem.dyad"
relevent_rem.dyad_obj <- rehshape(data = reh, output_format = "relevent-rem.dyad")

summary(relevent_rem.dyad_obj)


remify documentation built on Nov. 22, 2023, 5:07 p.m.