replace_ids: Replace individual IDs

View source: R/replace_ids.R

replace_idsR Documentation

Replace individual IDs

Description

Replace the individual IDs in an object with new ones

Usage

replace_ids(x, ids)

## S3 method for class 'cross2'
replace_ids(x, ids)

## S3 method for class 'calc_genoprob'
replace_ids(x, ids)

## S3 method for class 'viterbi'
replace_ids(x, ids)

## S3 method for class 'sim_geno'
replace_ids(x, ids)

## S3 method for class 'matrix'
replace_ids(x, ids)

## S3 method for class 'data.frame'
replace_ids(x, ids)

Arguments

x

Object whose IDs will be replaced

ids

Vector of character strings with the new individual IDs, with the names being the original IDs.

Value

The input x object, but with individual IDs replaced.

Methods (by class)

  • replace_ids(cross2): Replace IDs in a "cross2" object

  • replace_ids(calc_genoprob): Replace IDs in output from calc_genoprob()

  • replace_ids(viterbi): Replace IDs in output from viterbi()

  • replace_ids(sim_geno): Replace IDs in output from sim_geno()

  • replace_ids(matrix): Replace IDs in a matrix

  • replace_ids(data.frame): Replace IDs in a data frame

Examples

iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
ids <- as.numeric(ind_ids(iron))

# replace the numeric IDs with IDs like "mouse003"
new_ids <- setNames( sprintf("mouse%03d", as.numeric(ids)), ids)

iron <- replace_ids(iron, new_ids)

qtl2 documentation built on April 22, 2023, 1:10 a.m.