{base} R# Documentation

base


require(R);

#' The R Base Package
imports "base" from "REnv";

The R Base Package

This package contains the basic functions which let R function as a language: arithmetic, input/output, basic programming support, etc. Its contents are available through inheritance from any environment.

For a complete list of functions, use ls("base").

The R Base Package

This package contains the basic functions which let R function as a language: arithmetic, input/output, basic programming support, etc. Its contents are available through inheritance from any environment.

For a complete list of functions, use ls("base").



.NET clr function exports
saveRDS

Serialization Interface for Single Objects Functions to write a single R object to a file, and to restore it.

readRDS

Serialization Interface for Single Objects Functions to write a single R object to a file, and to restore it.

save.image

Save R Objects

save.image() is just a short-cut for ‘save my current workspace’, i.e., save(list = ls(all.names = TRUE), file = ".RData", envir = .GlobalEnv). It is also what happens with q("yes").

isTRUE

Logical Operators

isTRUE(x) is the same as { is.logical(x) && length(x) == 1 && !is.na(x) && x }; isFALSE() is defined analogously. Consequently, if(isTRUE(cond)) may be preferable to if(cond) because of NAs. In earlier R versions, isTRUE <- function(x) identical(x, TRUE), had the drawback to be false e.g., for x <- c(val = TRUE).

isFALSE

Logical Operators

isTRUE(x) is the same as { is.logical(x) && length(x) == 1 && !is.na(x) && x }; isFALSE() is defined analogously. Consequently, if(isTRUE(cond)) may be preferable to if(cond) because of NAs. In earlier R versions, isTRUE <- function(x) identical(x, TRUE), had the drawback to be false e.g., for x <- c(val = TRUE).

numeric

Numeric Vectors

Creates or coerces objects of type "numeric". is.numeric is a more general test of an object being interpretable as numbers.

logical
character
integer
raw

Create the raw bytes vector

args

Argument List of a Function

Displays the argument names and corresponding default values of a (non-primitive or primitive) function.

commandArgs
commandArgs: Extract Command Line Arguments

Provides access to a copy of the command line arguments supplied when this R session was invoked.

range

Range of Values

range returns a vector containing the minimum and maximum of all the given arguments.

factor

Factors

The function factor is used to encode a vector as a factor (the terms ‘category’ and ‘enumerated type’ are also used for factors).

seq

Sequence Generation

Generate regular sequences. seq is a standard generic with a default method. seq.int is a primitive which can be much faster but has a few restrictions. seqalong and seqlen are very fast primitives for two common cases.

date

System Date and Time

year
c

Combine Values into a Vector or List

This is a generic function which combines its arguments. The Default method combines its arguments To form a vector. All arguments are coerced To a common type which Is the type Of the returned value, And all attributes except names are removed.

ifelse

Conditional Element Selection

ifelse returns a value with the same shape as test which is filled with elements selected from either yes or no depending on whether the element of test is TRUE or FALSE.

dim

Dimensions of an Object

Retrieve or set the dimension of an object.

rep

Replicate Elements of Vectors and Lists

rep replicates the values in x. It is a generic function, and the (internal) default method is described here.

rep.int
rep_len
rbind

Combine R Objects by Rows or Columns

Take a sequence of vector, matrix or data-frame arguments and combine by columns or rows, respectively. These are generic functions with methods for other R classes.

cbind

Combine R Objects by Rows or Columns

Take a sequence of vector, matrix or data-frame arguments and combine by columns or rows, respectively. These are generic functions with methods for other R classes.

t

matrix transpose

Given a matrix or data.frame x, t returns the transpose of x.

allocate

create an empty vector with specific count of null value filled

unit

get or set unit to a given vector

replace
invisible

Change the Print Mode to Invisible

Return a (temporarily) invisible copy of an object.

neg

A function to make the numeric value negative

join
append

Vector Merging

Add elements to a vector.

data.frame

Data Frames

The function data.frame() creates data frames, tightly coupled collections of variables which share many of the properties of matrices and of lists, used as the fundamental data structure by most of R's modeling software.

check.dimensions_agree

Utils function for check for dataframe object construction

nrow

The Number of Rows/Columns of an Array nrow and ncol return the number of rows or columns present in x.

ncol

The Number of Rows/Columns of an Array nrow and ncol return the number of rows or columns present in x.

list

Lists – Generic and Dotted Pairs

Functions to construct, coerce and check for both kinds of R# lists.

summary

Object Summaries

summary is a generic function used to produce result summaries of the results of various model fitting functions. The function invokes particular methods which depend on the class of the first argument.

is.empty

This function returns a logical value to determine that the given object is empty or not?

is.null

The Null Object

NULL represents the null object in R: it is a reserved word. NULL is often returned by expressions and functions whose value is undefined. is.null is a primitive function.

is.data.frame

Coerce to a Data Frame

Functions to check if an object is a data frame, or coerce it if possible.

is.list

Lists – Generic and Dotted Pairs

Functions to construct, coerce and check for both kinds of R lists.

is.function

Is an Object of Type (Primitive) Function?

Checks whether its argument is a (primitive) function.

is.vector

‘is.vector’ returns ‘TRUE’ if ‘x’ is a vector of the specified mode having no attributes other than names. It returns 'FALSE’ otherwise.

is.na

‘Not Available’ / Missing Values

NA is a logical constant of length 1 which contains a missing value indicator. NA can be coerced to any other vector type except raw. There are also constants NAinteger, NAreal, NAcomplex and NAcharacter of the other atomic vector types which support missing values: all of these are reserved words in the R language. The generic Function Is.na indicates which elements are missing. The generic Function Is.na<- sets elements To NA.

sink

Send R Output to a File sink diverts R output to a connection (and stops such diversions).

sink.number

sink.number() reports how many diversions are in use.

length

Length of an Object

Get or set the length of vectors (including lists) and factors, and of any other R object for which a method has been defined.

source

Run the external R# script. Read R Code from a File, a Connection or Expressions

causes R to accept its input from the named file or URL or connection or expressions directly. Input is read and parsed from that file until the end of the file is reached, then the parsed expressions are evaluated sequentially in the chosen environment.

getOption

Options Settings

Allow the user to set and examine a variety of global options which affect the way in which R computes and displays its results.

options
Options Settings

Allow the user to set and examine a variety of global options which affect the way in which R computes and displays its results.

options_flush

save the options configuration data to file

names

The Names of an Object

Functions to get or set the names of an object.

make.names

Make Syntactically Valid Names

Make syntactically valid names out of character vectors.

unique.names
rownames

Row and Column Names

Retrieve or set the row or column names of a matrix-like object.

colnames

Row and Column Names

Retrieve or set the row or column names of a matrix-like object.

stop

Stop Function Execution

stop stops execution of the current expression and executes an error action.

warning

Warning Messages

Generates a warning message that corresponds to its argument(s) and (optionally) the expression or function from which it was called.

warnings

Print Warning Messages

warnings and its print method print the variable last.warning in a pleasing form.

sQuote

Quote Text

Single or double quote text by combining with appropriate single or double left and right quotation marks.

dQuote

Quote Text

Single or double quote text by combining with appropriate single or double left and right quotation marks.

message

Diagnostic Messages

Generate a diagnostic message from its arguments.

cat

Concatenate and Print

Outputs the objects, concatenating the representations. cat performs much less conversion than print.

str

Compactly Display the Structure of an Arbitrary R# Object

Compactly display the internal structure of an R object, a diagnostic function and an alternative to summary (and to some extent, dput). Ideally, only one line for each ‘basic’ structure is displayed. It is especially well suited to compactly display the (abbreviated) contents of (possibly nested) lists. The idea is to give reasonable output for any R object. It calls args for (non-primitive) function objects. strOptions() Is a convenience function for setting options(str = .), see the examples.

print

Print Values

print prints its argument and returns it invisibly (via invisible(x)). It is a generic function which means that new printing methods can be easily added for new classes.

factors
auto
library

Loading/Attaching and Listing of Packages

library and require load and attach add-on packages.

load

Reload Saved Datasets

Reload datasets written with the function save.

save

Save R Objects

writes an external representation of R objects to the specified file. The objects can be read back from the file at a later date by using the function load or attach (or data in some cases).


[Document Index]