Description Usage Arguments Value See Also Examples

View source: R/group.rankings.R

Create an object of class `"grouped_rankings"`

which associates a
group index with an object of class `"rankings"`

. This allows the
rankings to be linked to covariates with group-specific values as the basis
for model-based recursive partitioning, see `pltree`

.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
group(x, index, ...)
as.grouped_rankings(x, ...)
## S3 method for class 'paircomp'
as.grouped_rankings(x, ...)
## S3 method for class 'grouped_rankings'
x[i, j, ..., drop = TRUE, as.grouped_rankings = TRUE]
## S3 method for class 'grouped_rankings'
format(x, max = 2L, width = 20L, ...)
``` |

`x` |
a |

`index` |
a numeric vector of length equal to the number of rankings specifying the subject for each ranking. |

`...` |
additional arguments passed on to |

`i` |
indices specifying groups to extract, may be any data type accepted
by |

`j` |
indices specifying items to extract, as for |

`drop` |
if |

`as.grouped_rankings` |
if |

`max` |
the maximum number of rankings to format per subject. |

`width` |
the maximum width in number of characters to format each ranking. |

An object of class `"grouped_rankings"`

, which is a vector of
of group IDs with the following attributes:

`rankings` |
The |

`index` |
An index match each ranking to each group ID. |

`R` |
A matrix with items ordered from last to first place, for each ranking. |

`S` |
The rankings matrix with the ranks replaced by the size of the chosen set for free choices and zero for forced choices. |

`id` |
A list with elements of the adjacency matrix that are incremented by each ranking. |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
# ungrouped rankings (5 rankings, 4 items)
R <- as.rankings(matrix(c(1, 2, 0, 0,
0, 2, 1, 0,
0, 0, 1, 2,
2, 1, 0, 0,
0, 1, 2, 3), ncol = 4, byrow = TRUE))
length(R)
R
# group rankings (first three in group 1, next two in group 2)
G <- group(R, c(1, 1, 1, 2, 2))
length(G)
## by default up to 2 rankings are shown per group, "..." indicates if
## there are further rankings
G
print(G, max = 1)
## select rankings from group 1
G[1,]
## exclude item 3 from ranking
G[, -3]
## rankings from group 2, excluding item 3
## - note group 2 becomes the first group
G[2, -3]
## index underlying rankings without creating new grouped_rankings object
G[2, -3, as.grouped_rankings = FALSE]
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.