nuget server logo nuget api documents
↑

API Docs / REnv / dataframe

dataframe

Full name SMRUCC.Rsharp.Runtime.Internal.Object.dataframe Assembly REnv Members 44

A data frame, a matrix-like structure whose columns may be of differing types (numeric, logical, factor and character and so on).

How the names Of the data frame are created Is complex, And the rest Of this paragraph Is only the basic story. If the arguments are all named And simple objects (Not lists, matrices Of data frames) Then the argument names give the column names. For an unnamed simple argument, a deparsed version Of the argument Is used As the name (With an enclosing I(...) removed). For a named matrix/list/data frame argument With more than one named column, the names Of the columns are the name Of the argument followed by a dot And the column name inside the argument: If the argument Is unnamed, the argument's column names are used. For a named or unnamed matrix/list/data frame argument that contains a single column, the column name in the result is the column name in the argument. Finally, the names are adjusted to be unique and syntactically valid unless check.names = FALSE.

00 Remarks

A data frame is a list of variables of the same number of rows with unique row names, given class "data.frame". If no variables are included, the row names determine the number of rows. The column names should be non-empty, And attempts To use empty names will have unsupported results. Duplicate column names are allowed, but you need To use check.names = False For data.frame To generate such a data frame. However, Not all operations On data frames will preserve duplicated column names: For example matrix-Like subsetting will force column names in the result To be unique. data.frame converts each of its arguments to a data frame by calling as.data.frame(optional = TRUE). As that Is a generic function, methods can be written to change the behaviour of arguments according to their classes: R comes With many such methods. Character variables passed To data.frame are converted To factor columns unless Protected by I Or argument stringsAsFactors Is False. If a list Or data frame Or matrix Is passed To data.frame it Is As If Each component Or column had been passed As a separate argument (except For matrices Protected by I). Objects passed To data.frame should have the same number Of rows, but atomic vectors (see Is.vector), factors And character vectors Protected by I will be recycled a whole number Of times If necessary (including As elements Of list arguments). If row names are Not supplied In the Call To data.frame, the row names are taken from the first component that has suitable names, For example a named vector Or a matrix With rownames Or a data frame. (If that component Is subsequently recycled, the names are discarded With a warning.) If row.names was supplied As NULL Or no suitable component was found the row names are the Integer sequence starting at one (And such row names are considered To be 'automatic’, and not preserved by as.matrix). If row names are supplied Of length one And the data frame has a Single row, the row.names Is taken To specify the row names And Not a column (by name Or number). Names are removed from vector inputs Not Protected by I. Default.stringsAsFactors Is a utility that takes getOption("stringsAsFactors") And ensures the result Is TRUE Or FALSE (Or throws an error if the value Is Not NULL).

Chambers, J. M. (1992) Data for models. Chapter 3 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.

01 Syntax

SMRUCC.Rsharp.Runtime.Internal.Object.dataframe

02 Methods

NameOverloadsSummary
.ctor 1 do data clone
add 2 add or replace a column vector
add 1 add or replace a column vector
delete 1 delete columns from the dataframe.
detach 1 delete the specific col and get the deleted col array
getKeyByIndex 1 将列索引号转换为列名称
getVector 1 get column by name
getVector 2 get a vector from column data
ToString 1 show the dataframe dimension information
projectByColumn 1 data[, selector]
sliceByRow 2 data[selector, ]
getRowList 2
forEachRow 1 获取得到数据框之中每一行的数据([rowname => columns[]])
getRowIndex 1 这个函数返回的是以零为底的索引值
FilterByRowIndex 1
GetByRowIndex 1 所传递进来的索引编号,应该是以零为底的
subsetColData 1 索引编号,应该是以零为底的
getRowNames 1 这个函数会自动处理空值的情况
GetRowNumbers 1 get max length of the column vectors
CreateDataFrame 2 Cast a vector of CLR object to a dataframe
setNames 1 set column names via names function
hasName 1 has column name?
getNames 1 get column names
getBySynonym 1
checkColumnNames 2
CreateDataFrame 2
Create 2

03 Properties

NameOverloadsSummary
columns 1 the field vectors inside current data frame object, the vector dimension size of the fields could be a scalar value with just one element or vector dimension should equals to th…
rownames 1 the dataframe rownames
colnames 1 get all keys names of dataframe.columns data
nrows 1 column Array.Length
ncols 1 the number of the features in current dataframe object
empty 1 current dataframe object contains any data or not?
getColumnVector 2 dataframe.getKeyByIndex()), get column by 1-based offset
rowViews 1 debug view of this dataframe object in rows, debug used only.

04 Members

method .ctor #
#ctor(dataframe)

do data clone

Parameters
NameTypeDescription
clonedataframe

-

method add #
add``1(String, ``0())

add or replace a column vector

Type Parameters
NameDescription
T
Parameters
NameTypeDescription
keyString

-

value``0()

-

method add overload 2 #
add``1(String, IEnumerable(Of ``0))

add or replace a column vector

Type Parameters
NameDescription
T
Parameters
NameTypeDescription
keyString

-

valueIEnumerable(Of ``0)

-

method add #
add(String, Array)

add or replace a column vector

Parameters
NameTypeDescription
keyString

-

valueArray

-

method delete #
delete(String())

delete columns from the dataframe.

Parameters
NameTypeDescription
keysString()

-

method detach #
detach(String)

delete the specific col and get the deleted col array

Parameters
NameTypeDescription
colString

-

Returns

this function will returns nothing if the given col is not existed inside the dataframe columns.

method getKeyByIndex #
getKeyByIndex(Int32)

将列索引号转换为列名称

Parameters
NameTypeDescription
indexInt32

以1为底的列索引号

method getVector #
getVector``1(String())

get column by name

Remarks

this function returns a vector in full size always

Type Parameters
NameDescription
T
Parameters
NameTypeDescription
synonymString()

同意名列表

Returns

function may returns nothing if all of the given name is missing from the dataframe object.

(这个函数只会返回碰见的第一个同意名的列数据)

method getVector #
getVector(String, Boolean)

get a vector from column data

Parameters
NameTypeDescription
nameString

-

fullSizeBoolean

the data vector should be fill with the identical value when deal with the scalar value. This function just returns the scalar value by default is the target column contains just one element

Returns

this function returns nothing if the given name is not exists in the dataframe fields.

method ToString #
ToString

show the dataframe dimension information

method projectByColumn #
projectByColumn(Array, Environment, Boolean, Boolean, Boolean)

data[, selector]

Parameters
NameTypeDescription
selectorArray

-

reverseEnvironment

only works for the character index

strictBoolean

the strict option for the dataframe column projection, this option has different behaviours for deal with the missing data column:

for strict mode, an error exception will generates for break the program executation for non-strict mode, the missing column will be added with all element vector is NULL

Returns

dataframe

method sliceByRow overload 2 #
sliceByRow(Boolean(), Environment)
Remarks

which is true is zero-based by default

Parameters
NameTypeDescription
flagsBoolean()

-

envEnvironment

-

method sliceByRow #
sliceByRow(Array, Environment, Boolean)

data[selector, ]

Parameters
NameTypeDescription
selectorArray

accepts:

  1. logical vector as row selector
  2. integer vector for take rows by row number
  3. character vector for take rows by row name
method getRowList overload 2 #
getRowList(Int32, Boolean)

所传递进来这个函数的索引编号应该是以零为底的

Parameters
NameTypeDescription
indexInt32

index: integer 0 based

dropBoolean

当drop参数为false的时候,返回一个数组向量 反之返回一个list

method forEachRow #
forEachRow(String())

获取得到数据框之中每一行的数据([rowname => columns[]])

Parameters
NameTypeDescription
colKeysString()

-

method getRowIndex #
getRowIndex(Object)

这个函数返回的是以零为底的索引值

Parameters
NameTypeDescription
anyObject

-

method FilterByRowIndex #
FilterByRowIndex(Int32(), Environment)
Parameters
NameTypeDescription
skipsInt32()

1-based index to be filter

envEnvironment

-

method GetByRowIndex #
GetByRowIndex(Int32(), Environment)

所传递进来的索引编号,应该是以零为底的

Parameters
NameTypeDescription
indexInt32()

以零为底的索引号列表,-1对应的行将会返回空值的行数据

Returns

a dataframe object with row subset or an error message

method subsetColData #
subsetColData(Array, Int32(), Environment)

索引编号,应该是以零为底的

Parameters
NameTypeDescription
cArray

the column data, length of this array data maybe 1 or nrows

indexInt32()

索引编号,应该是以零为底的。-1的元素返回空值

method getRowNames #
getRowNames

这个函数会自动处理空值的情况

Returns

this function will generated a index row names automatically if the dataframe.rownames data is nothing, or this function will make a copy of the dataframe.rownames array.

method GetRowNumbers #
GetRowNumbers

get max length of the column vectors

method CreateDataFrame #
CreateDataFrame``1(IEnumerable(Of ``0))

Cast a vector of CLR object to a dataframe

Remarks

the class object property used as the dataframe column data

Type Parameters
NameDescription
T
Parameters
NameTypeDescription
dataIEnumerable(Of ``0)

-

method CreateDataFrame overload 2 #
CreateDataFrame``1(IReadOnlyCollection(Of NamedCollection(Of ``0)), IEnumerable(Of String))

Create dataframe from row data

Type Parameters
NameDescription
T
Parameters
NameTypeDescription
rowsIReadOnlyCollection(Of NamedCollection(Of ``0))

-

colNamesIEnumerable(Of String)

-

method setNames #
setNames(String(), Environment)

set column names via names function

Parameters
NameTypeDescription
namesString()

-

envirEnvironment

-

Example

names(df) = x; ' equals to colnames(df) = x;

method hasName #
hasName(String)

has column name?

Parameters
NameTypeDescription
nameString

-

method getNames #
getNames

get column names

property columns #
columns

the field vectors inside current data frame object, the vector dimension size of the fields could be a scalar value with just one element or vector dimension should equals to the dimension size of dataframe.rownames.

Remarks

长度为1或者长度为n

property rownames #
rownames

the dataframe rownames

property colnames #
colnames

get all keys names of dataframe.columns data

property nrows #
nrows

column Array.Length

Returns

the row number is tested based on the ncol, if the ncol is zero, then the function GetRowNumbers will returns zero directly.

property ncols #
ncols

the number of the features in current dataframe object

property empty #
empty

current dataframe object contains any data or not?

Returns

empty is true means contains no rows data or no columns

property getColumnVector overload 2 #
getColumnVector(String)

get column by name

Returns

this property always returns a vector in full size(length is equals to dataframe.nrows), orelse the value null if the given columnName is not exists in the dataframe column fields.

property getColumnVector #
getColumnVector(Int32)

dataframe.getKeyByIndex(), get column by 1-based offset

Parameters
NameTypeDescription
indexInt32

-

property rowViews #
rowViews

debug view of this dataframe object in rows, debug used only.

method getVector overload 2 #
getVector(String())
method getBySynonym #
getBySynonym(String())
method checkColumnNames overload 2 #
checkColumnNames(String())
method checkColumnNames #
checkColumnNames(IEnumerable(Of String), Environment)
method getRowList #
getRowList()
method CreateDataFrame overload 2 #
CreateDataFrame(IEnumerable(Of T))
method CreateDataFrame #
CreateDataFrame(Dictionary(Of String, T()), IEnumerable(Of String))
method Create overload 2 #
Create(IEnumerable(Of String), ArgumentReference())
method Create #
Create(ArgumentReference())