Learn R Programming

SciencesPo (version 1.02.12)

colNames: Column names as (always) a character vector

Description

A convenience function using either character vectors or numeric vectors to specify a subset of a data.frame.

Usage

colNames(data, cols)

Arguments

data
the input data.frame.
cols
the names or numeric position you want.

Value

  • A character vector of the desired names.

Examples

Run this code
colNames(iris, 1:3)

Run the code above in your browser using DataLab