Learn R Programming

nat (version 1.8.24)

as.data.frame.neuronlist: 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 neuronlist
as.data.frame(x, row.names = names(x), optional = FALSE, ...)

data.frame(x) <- value

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

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.

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

See Also

data.frame, neuronlist

Examples

Run this code
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

Run the code above in your browser using DataLab