Learn R Programming

haplotypes (version 1.1.3.1)

rownames-methods: Retrieve or set the row names

Description

Function to get or set row names of a sequence matrix in a Dna object or distance matrix (or matrices) in a Parsimnet object.

Usage

# S4 method for Dna
rownames(x)
# S4 method for Parsimnet
rownames(x)
# S4 method for Dna
rownames(x)<-value
# S4 method for Parsimnet
rownames(x)<-value

Arguments

x

an object of class Dna or Parsimnet.

value

a character vector of the same length as number of sequences or a list of the same length as number of networks including vertex names for each network. See ‘Examples’

Methods

signature(x = "Dna")

signature(x = "Parsimnet")

Examples

Run this code

data("dna.obj")
x<-dna.obj

### Method for signature 'Dna'.

## Getting sequence names.
rownames(x)

## Setting sequence names.
rownames(x)<-c(1:nrow(x))
rownames(x)

### Method for signature 'Parsimnet'.
x<-dna.obj

##single network
p<-parsimnet(x)

##Getting vertex names
rownames(p)

## Setting vertex names.
rownames(p)<-list(c(1:nrow(p@d[[1]])))
rownames(p)
plot(p)

## Multiple networks with 99% connection limit.
p<-parsimnet(x,prob=.99) 

## Getting vertex names
rownames(p)

## Setting vertex names.
rownames(p)<-list(1:9, 10, 11,12:13,14,15:16)
rownames(p)



Run the code above in your browser using DataLab