Reduce
Reduce函数是将每次计算后的结果保留,并与下一个数字进行计算,这是和 apply 函数不同的,例如下面合并多个数据框
> df1 <- data.frame(id=c(1,2,3),name=c('Joseph','Summer','dograbbit'))
> df2 <- data.frame(id=c(1,2),money=c('0','100'))
> df3 <- data.frame(id=c(1,3),looking=c('handsom','cute'))
## Reduce
> Reduce(function(x,y) merge(x,y,by="id",all.x=TRUE),list(df1,df2,df3))
id name money looking
1 1 Joseph 0 handsom
2 2 Summer 100 <NA>
3 3 dograbbit <NA> cute
assign
get
变量名称和字符串的转换
> a1
Error: object 'a1' not found
> a2
Error: object 'a2' not found
> for(i in c("a1","a2")){
+ assign(i,1)
+ }
> a1
[1] 1
> a2
[1] 1
> get("a1")
[1] 1
quote
eval
parse
expression
bquote
substitute
name
symbol
https://blog.csdn.net/songzhilian22/article/details/49487467