nuget server logo nuget api documents
↑

API Docs / REnv / reshape2

reshape2

Full name SMRUCC.Rsharp.Runtime.Internal.Invokes.LinqPipeline.reshape2 Assembly REnv Members 11

01 Syntax

SMRUCC.Rsharp.Runtime.Internal.Invokes.LinqPipeline.reshape2

02 Methods

NameOverloadsSummary
tuple 1 Aggregate two or more sequence
melt 1 melt: Convert an object into a molten data frame.
shift 1 shift: Fast lead/lag for vectors and lists lead or lag vectors, lists, data.frames or data.tables implemented in VisualBasic for speed.
flip_list 1 flip the list key-value pair mapping to value-key pair mapping
decompose 2 split dataframe by a cell string value split result
ConstructDataframe 1 Re-construct a dataframe object from a given set of the row data.
vector_fill 1 fill content which is indexed by a given value list
melt_dataframe 1
melt_array 1
melt_list 1

03 Members

method tuple #
tuple(Object, list, Environment)

Aggregate two or more sequence

Parameters
NameTypeDescription
zipObject

-

argslist

-

envEnvironment

-

method melt #
melt(Object, Boolean, String, list, Environment)

melt: Convert an object into a molten data frame.

This the generic melt function. See the following functions for the details about different data structures

Parameters
NameTypeDescription
dataObject

Data set to melt

na_rmBoolean

Should NA values be removed from the data set? This will convert explicit missings to implicit missings.

value_nameString

name of variable used to store values

argslist

further arguments passed To Or from other methods.

envEnvironment

-

Returns
  1. melt.data.frame for data.frames
  1. melt.array for arrays, matrices And tables
  2. melt.list for lists
method shift #
shift(Object, Object, Object, Object, Boolean, Environment)

shift: Fast lead/lag for vectors and lists

lead or lag vectors, lists, data.frames or data.tables implemented in VisualBasic for speed.

shift accepts vectors, lists, data.frames or data.tables. It always returns a list except when the input is a vector and length(n) == 1 in which case a vector is returned, for convenience. This is so that it can be used conveniently within data.table's syntax. For example, DT[, (cols) := shift(.SD, 1L), by=id] would lag every column of .SD by 1 for each group and DT[, newcol := colA + shift(colB)] would assign the sum of two vectors to newcol.

Argument n allows multiple values. For example, DT[, (cols) := shift(.SD, 1:2), by=id] would lag every column of .SD by 1 And 2 for each group. If .SD contained four columns, the first two elements of the list would correspond to lag=1 And lag=2 for the first column of .SD, the next two for second column of .SD And so on. Please see examples for more.

shift Is designed mainly for use in data.tables along with := Or set. Therefore, it returns an unnamed list by default as assigning names for each group over And over can be quite time consuming with many groups. It may be useful to set names automatically in other cases, which can be done by setting give.names to TRUE.

Remarks

The function behavior is different at here when compare with the shift function of the data.table package from the original R language: the shift function from R language not allow the fill data be nothing, but the shift function in R# language will behavior a different result: when the fill value is nothing at here, this function will becomes skip for type is lag or shift and this function will becomes take for type is lead.

Parameters
NameTypeDescription
xObject

A vector, list, data.frame Or data.table.

nObject

integer vector denoting the offset by which to lead or lag the input. To create multiple lead/lag vectors, provide multiple values to n; negative values of n will "flip" the value of type, i.e., n=-1 and type='lead' is the same as n=1 and type='lag'.

this parameter could also be a character vector of the names for removes from a given list, if the input x is a tuple list object

fillObject

Value to use for padding when the window goes beyond the input length.

typeObject

default is "lag" (look "backwards"). The other possible values "lead" (look "forwards") and "shift" (behave same as "lag" except given names).

give_namesBoolean

default is FALSE which returns an unnamed list. When TRUE, names are automatically generated corresponding to type and n. If answer is an atomic vector, then the argument is ignored.

Returns

A list containing the lead/lag of input x.

method flip_list #
flip_list(list, Environment)

flip the list key-value pair mapping to value-key pair mapping

Remarks

this function only works for the value is character vector, null value inside the list will be ignored

Parameters
NameTypeDescription
llist

Should be a tuple list object

envEnvironment

-

method decompose overload 2 #
decompose(dataframe, String, String, Environment)

split dataframe by a cell string value split result

Parameters
NameTypeDescription
dfdataframe

-

byString

the colname for do the cell content split

splitString

the delimiter string expression for split the cell contents

envEnvironment

-

method decompose #
decompose(dataframe, Int32, String, Environment)

split dataframe by a cell string value split result

Parameters
NameTypeDescription
dfdataframe

-

byInt32

the column index

splitString

the delimiter string for split the text in a cell

envEnvironment

-

Returns

A new dataframe object that split by the given column its cell text value

method ConstructDataframe #
ConstructDataframe(IReadOnlyCollection(Of NamedCollection(Of Object)), String())

Re-construct a dataframe object from a given set of the row data.

Parameters
NameTypeDescription
rowsIReadOnlyCollection(Of NamedCollection(Of Object))

the row data collection

colsString()

the column names

method vector_fill #
vector_fill(Object, list, Object, Environment)

fill content which is indexed by a given value list

Remarks

the length of vector x should be equals to the length of index.

Parameters
NameTypeDescription
xObject

-

valueslist

-

indexObject

-

envEnvironment

-

method melt_dataframe #
melt_dataframe(dataframe, Boolean, String, list, Environment)
method melt_array #
melt_array(Object, Boolean, String, list, Environment)
method melt_list #
melt_list(list, Boolean, String, list, Environment)