Learn R Programming

qtl2 (version 0.24)

replace_ids: Replace individual IDs

Description

Replace the individual IDs in an object with new ones

Usage

replace_ids(x, ids)

# S3 method for cross2 replace_ids(x, ids)

# S3 method for calc_genoprob replace_ids(x, ids)

# S3 method for viterbi replace_ids(x, ids)

# S3 method for sim_geno 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)

  • cross2: Replace IDs in a "cross2" object

  • calc_genoprob: Replace IDs in output from calc_genoprob()

  • viterbi: Replace IDs in output from viterbi()

  • sim_geno: Replace IDs in output from sim_geno()

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab