column_class: Find columns of data in a data.frame for a type of class

View source: R/column_class.R

column_classR Documentation

Find columns of data in a data.frame for a type of class

Description

This convienence function finds the data of a specified type in the passed data.frame.

Usage

column_class(x, class = NULL, mode = c("label", "index")[1])

Arguments

x

An object of data.frame type.

class

The type of class to search for. If this is omitted then the classes of each column will be returned.

mode

How you would like the column references to be used. Current values are:

label

The name of the column label with the specified class.

index

The numerical index of the column with specified class.

Value

A list of labels or indicies indicating where columns of the queried type exist or a list of all column classes.

Author(s)

Rodney J. Dyer rjdyer@vcu.edu

Examples

locus <- c( locus(1:2), locus(c(1,1)), locus(c(2,2)), locus(2:3) )
pop <- factor( c(rep("A",2), rep("B",2)))
df <- data.frame( Population=pop, X=runif(4), TPI=locus )
df
column_class(df,"factor")
column_class(df,"numeric")
column_class(df, "locus" )
column_class(df,"locus",mode="index")

dyerlab/gstudio documentation built on Feb. 2, 2024, 8:24 p.m.