get-set-neuronlist-data.frame: Get or set the attached data.frame of a neuronlist

as.data.frame.neuronlistR Documentation

Get or set the attached data.frame of a neuronlist

Description

For as.data.frame, when there is no attached data.frame the result will be a data.frame with 0 columns but an appropriate number of rows, named by the objects in the neuronlist.

data.frame<- methods set the data frame attached to an object. At present this is only used for neuronlist objects.

Usage

## S3 method for class 'neuronlist'
as.data.frame(x, row.names = names(x), optional = FALSE, ...)

data.frame(x) <- value

## S3 replacement method for class 'neuronlist'
data.frame(x) <- value

Arguments

x

neuronlist to convert

row.names

row names (defaults to names of objects in neuronlist, which is nearly always what you want.)

optional

ignored in this method

...

additional arguments passed to data.frame (see examples)

value

The new data.frame to be attached to x

Value

for as.data.frame.neuronlist, a data.frame with length(x) rows, named according to names(x) and containing the columns from the attached data.frame, when present.

for data.frame<-.neuronlist, a neuronlist with the attached data.frame.

See Also

data.frame, neuronlist

Examples

head(as.data.frame(kcs20))

# add additional variables
str(as.data.frame(kcs20, i=seq(kcs20), abc=LETTERS[seq(kcs20)]))
# stop character columns being turned into factors
newdf <- as.data.frame(kcs20, i=seq(kcs20), abc=LETTERS[seq(kcs20)], 
  stringsAsFactors=FALSE)
str(newdf)
data.frame(kcs20)=newdf

nat documentation built on May 29, 2024, 10:36 a.m.