1) dot (함수 말고 마침표) .
Usage of Dot / Period in R Functions
I recently saw a function in R where someone had used . as an argument. I can't seem to find any documentation on this (other than the use of ellipsis or "dot-dot-dot"). Can someone either point me...
stackoverflow.com
큰 의미는 없고 변수 대체용..?
2) .SD
replace_with_mean <- function(x){ifelse(is.na(x),mean(x, na.rm = TRUE),x)}
output <- DT[,lapply(.SD, replace_with_mean)]
print(head(output))
Using .SD for Data Analysis
To illustrate what I mean about the reflexive nature of .SD, consider its most banal usage: That is, Pitching[ , .SD] has simply returned the whole table, i.e., this was an overly verbose way of writing Pitching or Pitching[]: In terms of subsetting, .SD i
cran.r-project.org
저런 식으로 쓰이는데 SUBSET을 선택하는 거라고 한다. 하위 집단 전체..? 내가 이해한 바로는 ..
subset 함수와 같은 기능도 하는 듯 하다 . .
위 코드에서는 replace_with_mean 이 적용된 dt 전체를 가리키는 것 같다. . ?
3) f.
f-expressions — datatable documentation
f-expressions — datatable documentation
f-expressions The datatable module exports a special symbol f, which can be used to refer to the columns of a frame currently being operated on. If this sounds cryptic, consider that the most common way to operate on a frame is via the square-bracket call
datatable.readthedocs.io
data.table에서만 쓰이는 것 같다.
frame(data)의 특정 열을 추출하려면 원래 data$price 이런식으로 해야하는데
그냥.. f.price 이렇게 선택할 수 있는 듯.
4) .I
DT[, .(rownum=.I, Price)][Price == max(Price, na.rm = TRUE), rownum]
Understanding .I in data.table in R - Stack Overflow
Understanding .I in data.table in R
I was playing around with data.table and I came across a distinction that I'm not sure I quite understand. Given the following dataset: library(data.table) set.seed(400) DT <- data.table(x = s...
stackoverflow.com
본 데이터셋의 행번호를 나타내는 vector 라고 한다 .. 이것도 다른 것들처럼 임의로 쓰는 기호..?
'R > 참고자료' 카테고리의 다른 글
의사결정나무를 예측용으로 사용하기 (0) | 2022.11.16 |
---|---|
R 오류 (0) | 2022.11.12 |
dplyr 패키지 설치 중 'lifecycle' lazy loading 오류 시 해결법 (0) | 2022.09.30 |
댓글