remove_fill: Remove fill

View source: R/generic_reshape.r

remove_fillR Documentation

Remove fill

Description

Like remove_nodes, but only removing the fill nodes

Usage

remove_fill(
  .tokens,
  node,
  rm_subset_fill = NULL,
  rm_subset = NULL,
  keep_shared = FALSE
)

Arguments

.tokens

A tokenIndex in which nodes are selected with select_nodes.

node

The name of the node that is to be mutated

rm_subset_fill

A subset on the fill nodes. Can only directly use token column. For example, use pos == 'VERB' to remove only verbs

rm_subset

A subset expression (that evaluates to a logical vector) to more specifically specify which nodes to remove. The token column for each labeled node in the tquery can be referred to as label$column.

keep_shared

If there is another node that has the same fill nodes, should the fill nodes that are shared also be removed?

Value

A tokenIndex with a .nodes attribute

Examples

tokens = tokens_spacy[tokens_spacy$doc_id == 'text1',]

## use a tquery to label the nodes that you want to manipulate
tq = tquery(pos = 'VERB',
            children(label = 'object', relation='dobj'))

## apply query to select nodes
tokens2 = select_nodes(tokens, tq) 

remove_fill(tokens2, 'object')

vanatteveldt/rsyntax documentation built on June 14, 2022, 7:42 a.m.