Learn R Programming

disordR (version 0.0-7)

misc: Miscellaneous functions

Description

This page documents various functions that work for disords, and I will add to these from time to time as I add new functions that make sense for disord objects. Functions like sin() and abs() work as expected: they take and return disord objects with the same hash as x (which means that idiom like x + sin(x) is accepted). However, there are a few functions that are a little more involved:

  • rev() reverses its argument and returns a disord object with a reversed hash, which ensures that rev(rev(x))==x.

  • sort() returns a vector of sorted elements.

  • length() returns the length of the data component of the object.

  • sapply(X,f) returns a disord object which is the result of applying f() to each element of X.

  • match(x,table) should behave as expected but note that if table is a disord, the result is not defined (because it is not known where the elements of x occur in table). Nevertheless x %in% table is defined and returns a disord object.

Arguments

x

Object of class disord

Value

Returns a disord

Examples

Run this code
# NOT RUN {
a <- disord(c(a=1,b=2,c=7))
names(a)
length(a)
sqrt(a)
is.na(a) <- c(FALSE,FALSE,TRUE)

# powers() and vars() in the mvp package return lists; see the vignette
# for more discussion.

l <- disord(list(3,6:9,1:10))  
sapply(l,length)

# }

Run the code above in your browser using DataLab