Data Object Management

Data Object Management

The following functions are useful for data object management in R:

FunctionDescription
class()Identify the class of a named object.
colnames(); rownames()Retrieve or set the column or row names of an object.
dim()Retrieve or set the dimensions of a rectangular data object.
dimnames()Get or set the dim names of an object.
head()Returns the first n rows of a data object.
grep()search for data objects or files based on a pattern within each element of a character vector. See chapter "Misc Tricks" for a full discussion on wind cards and regular expressions.
length()Get or set the length of vectors (including lists) and factors.
ls()returns a vector of character strings giving the names of the objects inn the specified environment (frame or directory). If no environment is specified, ls() shows what data and functions a user has defined.
ls.str()A variation of ls() that also provides data object structure information.
mode(0set or get the storage mode of a data object.
nchar()Count the number of characters in a character vector.
ncol(); nrow()return the number of columns or rows of a data object.
objects()same as ls().
str()Display the internal structure of an R object; a diagnostic function that is very helpful assessing nested lists, geo-spatial objects with several layers and other large data objects with meta data.
summary()Result summary for describing model objects; results depend on data class.
tail()Returns the last n rows of a data object.

Back | Next

Leave a Reply