Monday, January 14, 2013

FREQUENTLY USED R FUNCTIONS

FREQUENTLY USED R FUNCTIONS



REVISED: Saturday, March 2, 2013




Frequently used R functions.

You can view a function's code by typing the function name without the ( ). Notice in some cases you have to use a "single" character string.

I.  FREQUENTLY USED R FUNCTIONS

A. args( )

Use args(object) for the arguments of an object; e.g., vector, matrices, data frame, list, factor, and missing value.

> args(rnorm)
function (n, mean = 0, sd = 1) 

B. class( )

Use class(object) for the class or type of an object; e.g., character, numeric, integer, or logical. To insure numeric data is integer, type the number and follow it with a capital L operator; e.g., 12L.

> class(rnorm)
[1] "function"

C. head( )

Use head(object) to look at first six rows of a data frame object.

D. help( )

Use help(fctn) displays help on any function.

E. help.search( )

> help.search("rnorm")  # Argument pattern must be a single character string.

F. length( )

Use length(object) for the number of elements or components in an object.

G. ls( )

Use ls( ) to see which objects are currently defined.

H. mode( )

Use mode(object) to see the object's primitive data type.

I. names( )

Use names(object) to see names.

J. paste( )

Use paste(objects) to concatenat arguments seperated by commas into one string. Each argument in the string is separated by a single blank space.

K. paste0( )

Use paste0(objects) (the word paste with a numeric zero after it) to concatenat arguments seperated by commas into one string with NO seperating BLANK SPACES.

L. rm( )

Use rm( list=ls( ) ) to clear all currently defined objects.

M. str( )

Use str(object) to produce a one line description of arguments in an object.

N. strsplit( )

Use strsplit(object) to split a string, separated by a single blank spaces. strsplit( ) returns a list of the elements which were separated by single blank spaces within the string object.

O. summary( )

Use summary(object) for an overview of a data frame object.

Now you know the frequently used R functions.


Elcric Otto Circle







-->




-->




-->

















How to Link to My Home Page

It will appear on your website as:

"Link to: ELCRIC OTTO CIRCLE's Home Page"

No comments:

Post a Comment