subset.interData: Subsets an interData object by players and time

Description Usage Arguments Value Examples

Description

Takes an "interData" object and subsets it so that it only includes interactions involving the specifed players within the specified time range.

Usage

1
2
3
## S3 method for class 'interData'
subset(intData, players = intData$players,
  time.range = intData$datetime, and = T, ties = T)

Arguments

intData

an oject of class "interData" to subset.

players

players which to restrict the interactions to.

time.range

a length 2 sorted POSIXct vector with the first element specifying the earliest time of which to consider iteractions and the last element specifying the latest time.

and

logical specifying wether the players subsetted should occur in the player.1 and player.2 position (and = TRUE) or just in a single position (and = FALSE).

ties

logical indicting wether to inculde ties. Default is TRUE.

Value

a "subset" of the interData object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# generate generic data
interactions <- data.frame (a = sample (letters [1:10], 100, T),
                            b = sample (letters [1:10], 100, T),
                            o = sample (c(-1,-1,0,1,1), 100, T),
                            d = Sys.time () + runif (100, 40, 160))
# convert to interData object
id1 <- intTableConv (interactions)
# subset by players
subset (id1, id1$players [-c(1,2)])
# get any interaction with a single player
subset (id1, id1$players [1], and = FALSE)
#subset by time
subset (id1, time.range = c(mean (id1$datetime), id1$datetime ['end']))

nmmarquez/linHierarchy documentation built on May 23, 2019, 9:28 p.m.