Input and output Flashcards

1
Q

load()

A

load the datasets written with save

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

data(x)

A

loads specified data sets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

library(x)

A

load add-on packages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

read.table(file)

A

reads a file in table format and creates a data
frame from it; the default separator sep=”” is any whitespace; use header=TRUE to read the first line as a header of column names; use as.is=TRUE to prevent character vectors from being converted to fac- tors; use comment.char=”” to prevent “#” from being interpreted as a comment; use skip=n to skip n lines before reading data; see the help for options on row naming, NA treatment, and others

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

read.csv(“filename”,header=TRUE)

A

id. but with defaults set for reading comma-delimited files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

read.delim(“filename”,header=TRUE)

A

id. but with defaults set for reading tab-delimited files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

read.fwf(file,widths,header=FALSE,sep=””

A

read a table of f ixed width f ormatted data into a ’data.frame’; widths
is an integer vector, giving the widths of the fixed-width fields

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

save(file,…)

A

saves the specified objects (…) in the XDR platform-

independent binary format

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

save.image(file)

A

saves all objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

cat(…, file=””, sep=” “)

A

prints the arguments after coercing to

character; sep is the character separator between arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

print(a, …)

A

prints its arguments; generic, meaning it can have differ-

ent methods for different objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

format(x,…)

A

format an R object for pretty printing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

write.table(x,file=”“,row.names=TRUE,col.names=TRUE,

sep=” “)

A

prints x after converting to a data frame; if quote is TRUE, character or factor columns are surrounded by quotes (“); sep is the field separator; eol is the end-of-line separator; na is the string for missing values; use col.names=NA to add a blank column header to get the column headers aligned correctly for spreadsheet input

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

sink(file)

A

output to file, until sink()
Most of the I/O functions have a file argument. This can often be a charac- ter string naming a file or a connection. file=”” means the standard input or output. Connections can include files, pipes, zipped files, and R variables. On windows, the file connection can also be used with description = “clipboard”. To read a table copied from Excel, use
x ,col.names=NA)
For database interaction, see packages RODBC, DBI, RMySQL, RPgSQL, and ROracle. See packages XML, hdf5, netCDF for reading other file formats.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly