huxtable (version 4.6.0)

[.huxtable: Subset a huxtable

Description

Subset a huxtable

Usage

# S3 method for huxtable
[(x, i, j, drop = FALSE)

# S3 method for huxtable [(x, i, j) <- value

# S3 method for huxtable $(x, name) <- value

# S3 method for huxtable [[(x, i, j) <- value

Arguments

x

A huxtable.

i

Rows to select.

j, name

Columns to select.

drop

Not used.

value

A matrix, data frame, huxtable or similar object.

Value

A huxtable.

Details

[ always returns a huxtable, while $ and [[ return the underlying data.

For the replacement function [<-, if value is a huxtable, then its cell properties will be copied into x. In addition, if value fills up an entire column, then column properties will be copied into the replaced columns of x, and if it fills up an entire row, then row properties will be copied into the replaced rows of x.

Replacement functions $<- and [[<- replace existing data without affecting any properties.

Examples

Run this code
# NOT RUN {
jams[1:3, ]
class(jams[1:3, ])
jams[, 1]
jams$Type
prices <- huxtable(c("Price", 1.70, 2.00, 2.20))
number_format(prices) <- 2
bold(prices) <- TRUE
jams[, 2] <- prices
jams

data(jams)
jams$price <- c("Price", 1.70, 2.00, 2.20)
jams
# }

Run the code above in your browser using DataLab