Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 핵개발
- 산입범위
- 산입 범위
- 비행기 추락
- 통계 오류
- 비율
- t-test
- 성악설
- R4DS
- R 프로그래밍
- R 기초
- 선형성
- 동전 던지기
- 인터스텔라
- 티모시페리스
- 최저시급 개정안
- 비선형성
- 이기적 유전자
- 통계오류
- 멘탈관리
- 수학적 사고
- t검정
- 유닛테스트
- 찬물샤워
- 핵 개발
- 큰수의 법칙
- 최저 시급
- 아인슈타인
- 조던피더슨
- 자기관리
Archives
- Today
- Total
public bigdata
%>% (R4DS 일부, help("%>%) 일부) 정리 본문
<dot>
https://stackoverflow.com/questions/35272457/what-does-the-dplyr-period-character-reference
What does the dplyr period character "." reference?
What does the period . reference in the following dplyr code?: (df <- as.data.frame(matrix(rep(1:5, 5), ncol=5))) # V1 V2 V3 V4 V5 # 1 1 1 1 1 1 # 2 2 2 2 2 2 # 3 3 3 3 3 3...
stackoverflow.com
Placing lhs elsewhere in rhs call Often you will want lhs to the rhs call at another position than the first. For this purpose you can use the dot (.) as placeholder. For example, y %>% f(x, .) is equivalent to f(x, y) and z %>% f(x, y, arg = .) is equivalent to f(x, y, arg = z).
Using the dot for secondary purposes Often, some attribute or property of lhs is desired in the rhs call in addition to the value of lhs itself, e.g. the number of rows or columns. It is perfectly valid to use the dot placeholder several times in the rhs call, but by design the behavior is slightly different when using it inside nested function calls. In particular, if the placeholder is only used in a nested function call, lhs will also be placed as the first argument! The reason for this is that in most use-cases this produces the most readable code. For example, iris %>% subset(1:nrow(.) %% 2 == 0) is equivalent to iris %>% subset(., 1:nrow(.) %% 2 == 0) but slightly more compact. It is possible to overrule this behavior by enclosing the rhs in braces. For example, 1:10 %>% {c(min(.), max(.))} is equivalent to c(min(1:10), max(1:10)).
'R programming' 카테고리의 다른 글
mutiple plot function 코드 뜯어 보기 (0) | 2019.09.28 |
---|---|
advanced R 자료_비표준 평가 관련3 (0) | 2019.09.03 |
apply 계열 함수 정리하기 (0) | 2019.09.01 |
tidyverse other verbs, tips (0) | 2019.09.01 |
Tidy evaluation, most common actions(개인적 정리)_비표준 평가 관련2 (0) | 2019.08.29 |