neuronlist-dataframe-methods | R Documentation |
[.neuronlist
and [<-.neuronlist
behave like the
corresponding base methods ([.data.frame
, [<-.data.frame
)
allowing extraction or replacement of parts of the data.frame attached to
the neuronlist.
droplevels
Remove redundant factor levels in dataframe
attached to neuronlist
with
Evaluate expression in the context of dataframe
attached to a neuronlist
head
Return the first part of data.frame attached to
neuronlist
tail
Return the last part of data.frame attached to
neuronlist
## S3 method for class 'neuronlist'
x[i, j, drop]
## S3 replacement method for class 'neuronlist'
x[i, j] <- value
## S3 method for class 'neuronlist'
droplevels(x, except = NULL, ...)
## S3 method for class 'neuronlist'
with(data, expr, ...)
## S3 method for class 'neuronlist'
head(x, ...)
## S3 method for class 'neuronlist'
tail(x, ...)
x |
A neuronlist object |
i , j |
elements to extract or replace. Numeric or character or, for [
only, empty. Numeric values are coerced to integer as if by
|
drop |
logical. If |
value |
A suitable replacement value: it will be repeated a whole
number of times if necessary and it may be coerced: see the
Coercion section. If |
except |
indices of columns from which not to drop levels |
... |
Further arguments passed to default methods (and usually ignored) |
data |
A neuronlist object |
expr |
The expression to evaluate |
the attached dataframe with levels dropped (NB not the neuronlist)
[.data.frame
, @seealso [<-.data.frame
droplevels
with
head
tail
Other neuronlist:
*.neuronlist()
,
is.neuronlist()
,
neuronlistfh()
,
neuronlist()
,
nlapply()
,
read.neurons()
,
write.neurons()
## treat kcs20 as data.frame
kcs20[1, ]
kcs20[1:3, ]
kcs20[, 1:4]
kcs20[, 'soma_side']
# alternative to as.data.frame(kcs20)
kcs20[, ]
## can also set columns
kcs13=kcs20[1:3]
kcs13[,'side']=as.character(kcs13[,'soma_side'])
head(kcs13)
# or parts of columns
kcs13[1,'soma_side']='R'
kcs13['FruMARCM-M001205_seg002','soma_side']='L'
# remove a column
kcs13[,'side']=NULL
all.equal(kcs13, kcs20[1:3])
# can even replace the whole data.frame like this
kcs13[,]=kcs13[,]
all.equal(kcs13, kcs20[1:3])
## get row/column names of attached data.frame
# (unfortunately implementing ncol/nrow is challenging)
rownames(kcs20)
colnames(kcs20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.