tiers_sort | R Documentation |
Reorder the positions of tiers in all transcripts of a corpus object.
The ordering of the tiers will be done according to a vector of regular expressions defined in 'sortVector'.
If only certain transcripts or tiers should be affected set the parameter filterTranscriptNames
.
In case that you want to select transcripts by using regular expressions use the function act::search_makefilter
first.
tiers_sort( x, sortVector, filterTranscriptNames = NULL, addMissingTiers = FALSE, deleteTiersThatAreNotInTheSortVector = FALSE )
x |
Corpus object. |
sortVector |
Vector of character strings; regular expressions to match the tier names. The order within the vector presents the new order of the tiers. Use "\*" (=two backslashes and a star) to indicate where tiers that are not present in the sort vector but in the transcript should be inserted. |
filterTranscriptNames |
Vector of character strings; names of the transcripts to be included. |
addMissingTiers |
Logical; if |
deleteTiersThatAreNotInTheSortVector |
Logical; if |
Corpus object.
tiers_add, tiers_convert, tiers_delete, tiers_rename, helper_tiers_new_table, helper_tiers_sort_table
library(act) # Check the order of the existing tiers in the first two transcripts examplecorpus@transcripts[[1]]@tiers$name[order(examplecorpus@transcripts[[1]]@tiers$position)] examplecorpus@transcripts[[2]]@tiers$name[order(examplecorpus@transcripts[[2]]@tiers$position)] # Get tier names to create the sort vector sortVector <- c(examplecorpus@transcripts[[1]]@tiers$name, examplecorpus@transcripts[[2]]@tiers$name) # Revert the vector for demonstration. sortVector <- sortVector[length(sortVector):1] # This will only reorder the tiers. examplecorpus <- act::tiers_sort(x=examplecorpus, sortVector=sortVector) # Check again the order of the tiers examplecorpus@transcripts[[1]]@tiers$name[order(examplecorpus@transcripts[[1]]@tiers$position)] examplecorpus@transcripts[[2]]@tiers$name[order(examplecorpus@transcripts[[2]]@tiers$position)] # This will reorder the tiers and additionally add tiers that are given # in the sort vector but not present in the transcript. examplecorpus <- act::tiers_sort(x=examplecorpus, sortVector=sortVector, addMissingTiers=TRUE) # Check again the order of the tiers examplecorpus@transcripts[[1]]@tiers$name[order(examplecorpus@transcripts[[1]]@tiers$position)] examplecorpus@transcripts[[2]]@tiers$name[order(examplecorpus@transcripts[[2]]@tiers$position)] # Insert a tier called "newTier" into all transcripts in the corpus: for (t in examplecorpus@transcripts) { sortVector <- c(t@tiers$name, "newTier") examplecorpus <- act::tiers_sort(x=examplecorpus, sortVector=sortVector, filterTranscriptNames=t@name, addMissingTiers=TRUE) } # Check for example the first transcript: it now contains a tier called "newTier" examplecorpus@transcripts[[1]]@tiers # To get more examples and information about sorting see 'helper_tiers_sort_table()'.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.