create a list of the named or unnamed arguments

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: put arguments; data.frame(v=1:4,ch=c("a","B","c","d"),n=10); load() load the datasets written with save shorter vectors are recycled to the length of the longest data(x) loads specified data sets list(...) create a list of the named or unnamed arguments; library(x) load add-on packages list(a=c(1,2),b="hi",c=3i); read.table(file) reads a file in table format and creates a data array(x,dim=) array with data x; specify dimensions like frame from it; the default separator sep="" is any whitespace; use dim=c(3,4,2); elements of x recycle if x is not long enough header=TRUE to read the first line as a header of column names; use matrix(x,nrow=,ncol=) matrix; elements of x recycle to prevent character vectors from being converted to facfactor(x,levels=) encodes a vector x as a factor tors; use comment.char="" to prevent "#" from being interpreted as gl(n,k,length=n*k,labels=1:n) generate levels (factors) by speca comment; use skip=n to skip n lines before reading data; see the ifying the pattern of their levels; k is the number of levels, and n is help for options on row naming, NA treatment, and others the number of replications read.csv("filename",header=TRUE) id. but with defaults set for expand.grid() a data frame from all combinations of the supplied vecreading comma-delimited files tors or factors read.delim("filename",header=TRUE) id. but with defaults set rbind(...) combine arguments by rows for matrices, data frames, and for reading tab-delimited files others ￿ read.fwf(file,widths,header=FALSE,sep="", cbind(...) id. by columns read a table of f ixed width f ormatted data into a ’data.frame’; widths Slicing and extracting data is an integer vector, giving the widths of the fixed-width fields save(file,...) saves the specified objects (...) in the XDR platform- Indexing vectors independent binary format x[n] nth element save.image(file) saves all objects x[-n] all but the nth element cat(..., file="", sep=" ") prints the arguments after coercing to x[1:n] first n elements character; sep is the character separator between arguments x[-(1:n)] elements from n+1 to the end print(a, ...) prints its arguments; generic, meaning it can have differ- x[c(1,4,2)] specific elements ent methods for different objects x["name"] element named "name" format(x,...) format an R object for pretty printing x[x > 3] all elements greater than 3 write.table(x,file="",row.names=TRUE,col.names=TRUE, x[x > 3 & x < 5] all elements between 3 and 5 sep=" ") prints x after converting to a data frame; if quote is TRUE, x[x %in% c("a","and","the")] elements in the given set Variable conversion as.array(x),, as.numeric(x), as.logical(x), as.complex(x), as.character(x), ... convert type; for a complete list, use methods(...
View Full Document

This document was uploaded on 04/10/2014.

Ask a homework question - tutors are online