由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 请问面试 R 应该怎么准备?
相关主题
关于R的一个编程问题,怎么存储数据在一个向量?突然对直线拟合的R不明白起来了
这个R程序能帮改进一下吗?请教一个概率题的思路
两个有关于R的小问题?R question
R请教*apply的用法。Urgent R Question
今天又“R”了 -- 感想和请教。R 画图问题求教
更新一下Taste of R,再问两个R的问题。再问R的问题 - 关于matrix 的operation
How can I loop through a list of strings as variables in aa R loop question
请教 long form 的数据处理问题,先谢谢了!【R求问】关于vector赋值
相关话题的讨论汇总
话题: myseq话题: object话题: data话题: list话题: x1
进入Statistics版参与讨论
1 (共1页)
p*******y
发帖数: 125
1
好久没用过R了,应该怎么准备啊?
t*****w
发帖数: 254
2
When I had my job interview, they always tested my SAS skill.However I use R
all the time. To help your preparation, read my R codes to see how much you
can understand it.
%in%
?keyword
a<-matrix(0,nrow=3,ncol=3,byrow=T)
a1 <- a1/(t(a1)%*%spooled%*%a1)^.5 #standadization in discrim
a1<- a>=2; a[a1]
abline(h = -1:5, v = -2:3, col = "lightgray", lty=3)
abline(h=0, v=0, col = "gray60")
abs(r2[i])>r0
aggregate(iris[,1:4], list(iris$Species), mean)
AND: &; OR: |; NOT: !
anova(lm(data1[,3]~data1[,1]))
append(z,z1)
apply(data,1/2,function) # 1 row 2 col
apply(X, MARGIN, FUN, ARGs)
array(1:250, dim=c(10,5,5))
as.character(x)
as.matrix(x); # change vector into matrix
as.numeric(data[,-5])
assign("a[1]", x) ; get("a[1]")
attributes(object) # Returns an object's attribute list.
attributes(y)
b1<-cbind( 1,3:1,1:3)
biplot(exams.prc)
boxplot(density)
bulls<-bulls-matrix(colMeans(bulls),nrow=76,ncol=7,byrow=T) # minus means
cat("my function returns:", "n"); return(z1/x1)
cat(month.name, file="C:/.../temp.txt", sep="n")
chartr("ATGC", "TACG", myseq) # Returns complement for given DNA sequences.
class(mydata)
class(object) # Prints the object type.
cloud(mass~hls*svl) #load lattice package#
colMeans(A)
colnames(x1)<-c("A", "B", "C") #small case
combn(labels, m=2, FUN=paste, collapse="-"); #creates all combinations of
elements
cor(A)
cor(X1,X2, method = c( "spearman"))
cut(1:10,breaks=c(1,3,6,11),labels=c("1-2","3-5","6-10"))
data frames (different types)/ matrices (one data type)
data1 <- cbind(x1, x2, x3)
det(a)
diag(3,nrow=4,ncol=4)
diag(c(2,1,7))
diag(cov(A))
diag(diag(c))
dim(x)
dimnames(bull)<-list(1:nr,c("breed","salePr","YrHgt"))
dimnames(x)<-(list (c("bob", "John"), c("blue", "White"))) #or list(1:n,
c("…"))
dimnames=list(paste("g", 1:50, sep=""), paste("t", 1:10, sep=""))
dir() # Reads content of current working directory.
e%*%Lambda%*%t(e) #equal to sigma
e<-eigen(c)$vectors
edit() or fix( file) #edit file data
eigen(a)$values
eigen(a)$vectors
factor(animal <- c("d", "c", "m", "d", "d", "c")); table(animal)
factor(y, ordered=T, levels=c("CR", "PR", "SD", "PD") )
file.show("my_file")
for(i in 1:4) {print(tapply(as.vector(iris[,i]), factor(iris[,5]), mean))}
glm(y~x1+x2,family=binomial)
gregexpr("AT", myseq) # Searches 'myseq' for all matches of pattern "AT".
grep("ATG", myseq); # String searching with regular expression support
gsub("(...)", "\1_", "ATGCATTGGACGTTAG")
gsub("(...)", "\1_", y)
gsub("^ATG", "atg", myseq) # String substitution with regular expression
support.
head(mydata, n=10) # opposite to tail
help.search("")
help.start()
HTML(my_frame, file = "my_table.html")
if (a<=3) {b=1} else {b=2}
ifelse(test, true_value, false_value)
ifelse(x<5 | x>8,0,x)
install() load() library()
intersect(a,b); union(a,b)
iris$Species; # Returns the 'Species' column in the sample data frame 'iris'.
lapply(x, rev) # Reverses vectors
length(x);
letters[1:4]; LETTERS
levels()
levels(gender) <- c("Male", "Female")
li <- list(pi=pi, e = exp(1))
li[[1]] # the first element of list li
library( xlsReadWrite);write.xls( mydata, file="mydata.xls") )
library()
library(help=mypackage) # Lists all functions/objects of a library.
lines(x,y,col="red")
list.files(pattern=".txt$")
list[[1]][2]
lm(X4~X1+X2+X3+X5+X6+X7+X8+X9,data=AA)
lmer(Yield ~ 1 + (1 | Batch), Dyestuff, REML = FALSE) #linear mixed model
loadings(bull.prc)[,i]
ls()
ls.str(pattern="") # Lists object type info on all objects in a session.
lsf.str(pattern="") # Lists object type info on all functions in a session.
m <- m[,-1] # delete the first column of m
m <- matrix(1:6, nrow=2); # by default, bycolumn=T
m[,c(TRUE,FALSE,TRUE)]# logical indexing
m[1, , drop = FALSE] # is a 1-row matrix
m[1,] # the first row of matrix m
main=paste("Component ", i)
match(c("c","g"), letters)
matrix(as.numeric(data),nrow=,ncol=)
matrix(as.numeric(scan("address"))) # import list
matrix(scan(file='C:address\T1-10.dat'),byrow=T, ncol=9) ##scan by row
mean(qchisq(cc,5)) #5 is degreee of freedom
mode(object) # Prints the storage mode of an object.
my_object[c("B", "K", "M")]; #Subsetting by field names
names(x)<-c("apple", "pear")
nchar(myseq) # Computes length of strings.
nls(formula=y~exp(beta*x),data=CC, start=list(beta=-3))
numeric(12)
numeric(length(myMA[,1]))
Object Types in R: vectors;factors;data frames;matrices; arrays;lists;
functions
objects()
order(scores,decreasing=T)
p <- data.prc$rotation
pairs(data)
par(mfrow=c(3,3))
paste("C", 1:10, sep="")
plot() lines() points() abline() lengend()
plot(c(-2,3), c(-1,5), type = "n", xlab="x", ylab="y", asp = 1)
plot(x1, y1, xlab="strength md", ylab="density", type="p")
points(x,y)
points(y[1:32,2],y[1:32,1],col=2)
polyroot(c(1, 2, 1, 0, 0)) #x0, x1,x2?
powertran <- function(d, x){y <- rep(0, length(x));if (d==0) {y <- log(x)}
else {y <- (x^d-1)/d};y}
prcomp(temp1,corr=T)
predict(exams.prc,newdata=exam2) # could use old dataset
princomp(bull,cor=F) #prcomp for singular, sd is sqrt of variance
prod(x)
q()
qqnorm(x1,main="x1,indep")
qt(.975,61)
rbind(r1,r2,r3,r4,r5)
read.delim("clipboard", header=T)
read.table("C:\Users\T6-12.dat", sep=",", header=T)
read.table(file="my_table", header=TRUE, sep="t")
readLines("zzz.txt")
regexpr("AT", myseq) # Searches 'myseq' for first match of pattern "AT".
rep(c(1,2), each=3); rep(c(1,2), times=3) ; #default is "times="
require(stats)
return(x)
rm(list=ls())
rm(objects)
rowSums((myMA-rowMeans(myMA))^2)
rowSums; rowMeans; colSums; colMeans
s22=var(x2)*7/8
sample( 1:4, 10, replace=T )
sapply(1:100, function(x) paste(sample(c("A","T","G","C"), 20, replace=T),
collapse=""))
sapply(x, paste, collapse="") # Collapses vectors to strings
save(x, file="my_file.txt"); load(file="file.txt")
scan("my_file")
screeplot(data.prc,type='lines')
screeplot(exams.prc,type='lines')
sd(residual)
search() # Lists which packages are currently loaded.
setwd("C:\Users\exam")
shapiro.test(y3)
sink("My_R_Output");#redirect output; sink()
solve(e4)%*%a1
sort(score,decreasing=F) #sas use descending
source("http://.../biocLite.R");biocLite("preprocessCore") ;library("preprocessCore")
stop("values need to be <5")
stop("values need to be <5")
str(object) # Displays object types and structure of an R object.
strsplit("atbtc", "t")
strsplit(x,"a")
subset(DNase, Run == 1)
substring(myseq, c(1,4,7), c(2,6,10))
substring(myseq[1], 1:nchar(myseq[1]), 1:nchar(myseq[1])) # Vectorizes
single sequence.
summary(data.prc,loadings=T)
summary(object) # Generic summary info for all kinds of objects.
Sys.sleep(1); # pause 1 second
system.time( expression)
t(x)
tapply(incomes,state,mean))
tapply(vector, factor, FUN)
temp <- scan("Z:address\T1-2.dat", 0); data <- matrix(temp, nrow=41, byrow=T
);
text(1,0, "abline( h = 0 )", col = "gray60", adj = c(0, -.1))
text(1,3, "abline( 1, 2 )", col=2, adj=c(-.1,-.1))
title( paste("Distribution of prediction score", "n T-test P-value=0.0002") )
unique(x); x[duplicated(x)]
unlist(strsplit("ATGC_ATTG_GACG_TTAG_", "_"))
V5<-V2[3,]
warning("Value needs to be > 0")
while(condition) statements
write(SP500,"C:\..sp500.txt")
write.csv( mydata, file="C:/Users/.../mydata.csv")
write.table(data,"11.23 T1-6.txt",sep="t") #write function handles data by
column
writeLines(as.vector(t(cbind(myname, myseq))), "myseq.fasta")
writeLines(myseq); #print line by line
writeLines(strtrim(myseq, 10))
x %in% y; #match function
x <- 1:12;
x <- x[-1] # delete the 1st element of x
x%*%t(x)
x[10] # the tenth element of x x[2,3]
x[c(grep("^J", as.character(x), perl = F))] #search for matches and replace
x[is.na(x)]<-0 #is.na handle data by column
x<-1:9
x<-paste(c("X"),1:3, sep="")
x<-seq(1,10,by=1)
x1 <- data[,1]
x1=as.numeric(c1)
x1r=c*x1+s*x2
x5=c(rep(1,25),rep(0,25))
xlab="x", ylab="y"
xlim=c(-2.5,2.5),ylim=c(-3.5,3.5)
xlim=c(-3,3), ylim=c(0,1)
y <- list(1,2,a=4,5)
y$a # the element of y named a
y[,1][index==1]
y[c(3,4)] # a list containing elements 3 and 4 of y
y[grep("^...$", y)] # Removes incomplete triplets.
y<-seq(2,30,2)
y<-x[!is.na(x)]
z <- 0; while(z<5) {z <- z+2; print(z)}

【在 p*******y 的大作中提到】
: 好久没用过R了,应该怎么准备啊?
c***z
发帖数: 6348
3
I was never asked any R programming problems.
I was only asked which packages I used for what projects, I either told them
that I forget or I wrote my own.
I just said with R and google I can do everything in the world, and they are
happy with that...
S******y
发帖数: 1123
4
'tapply' is a question often asked in interview.
D*********2
发帖数: 535
5
哪家面试R?

【在 p*******y 的大作中提到】
: 好久没用过R了,应该怎么准备啊?
P*****r
发帖数: 52
6

them
are
哈哈哈,厉害。。。

【在 c***z 的大作中提到】
: I was never asked any R programming problems.
: I was only asked which packages I used for what projects, I either told them
: that I forget or I wrote my own.
: I just said with R and google I can do everything in the world, and they are
: happy with that...

B****n
发帖数: 11290
7
Google interviewed him.

: I was only asked which packages I used for what projects, I either told
them
: that I forget or I wrote my own.
: I just said with R and google I can do everything in the world, and they
are
: happy with that...

【在 P*****r 的大作中提到】
:
: them
: are
: 哈哈哈,厉害。。。

c***z
发帖数: 6348
8
some brother/sister posted a good list, where is it gone?
I*****a
发帖数: 5425
9
G ,A 都有可能问。

【在 D*********2 的大作中提到】
: 哪家面试R?
1 (共1页)
进入Statistics版参与讨论
相关主题
【R求问】关于vector赋值今天又“R”了 -- 感想和请教。
【R】保留matrix中某些值更新一下Taste of R,再问两个R的问题。
SAS code question, special two do loopHow can I loop through a list of strings as variables in a
how to get a length of a vector in SAS/IML请教 long form 的数据处理问题,先谢谢了!
关于R的一个编程问题,怎么存储数据在一个向量?突然对直线拟合的R不明白起来了
这个R程序能帮改进一下吗?请教一个概率题的思路
两个有关于R的小问题?R question
R请教*apply的用法。Urgent R Question
相关话题的讨论汇总
话题: myseq话题: object话题: data话题: list话题: x1