### Data
logical << numeric << complex << character
> complex(real=1, imaginary=pi)
> mode(x)
### Reading Data
> dna <- read.table("d:/data/dna.txt", header=T)
> dna <- read.table(" ", col.names=NULL)
> nsi <- read.table("nsi.dat")
> dimnames(nsi) <- list(NULL, c('x','y'))
> dimnames(nsi) <- list(NULL, paste("x", 1:35, sep="")
> dimnames(nsi)[[1]] // colnames(nsi)
> dimnames(nsi)[[2]] // rownames(nsi)
# Read tab delimiters
read.table("tab.dat", header=T, sep="t")
read.delim("tab.dat", header=T)
# Read SAS dataset (foreign package)
sashome <- "/Program Files/SAS/SAS 9.1" # The location where sas.exe is
example <- read.ssd(file.path("c:/cahn"), "example", sascmd = file.path(sashome, "sas.exe"))
### paste()
> paste('x',1:5,sep='')
> paste("A",1:5,sep=":") [1] "A:1" "A:2" "A:3" "A:4" "A:5"
> paste(1:5,"A",sep="/") [1] "1/A" "2/A" "3/A" "4/A" "5/A"
### is.as
vector, matrix, array, list, factor, function,
catergory, integer, numeric, character, logical, complex,
single, double, na, name, null, ts
# missing
> y<-c(1,NA,3,0,NA)
> y[is.na(y)] <- 0
### as
as.numeric, as.character, as.factor
### Sort data.frame
# sort a data.frame "design" with the order of design$ID
design <- design[order(design$ID),]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment