Allow use of patterns in setnames when new is a function
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reviewing setnames(), patterns(), and the related issue #3703, then compare the proposed single-function and multiple-function interpretations with patterns() usage in melt(). Define the supported matching and renaming behavior, including multiple patterns and functions, and verify it against the provided data.table example.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Allow the use of setnames(old = patterns(...), new = renaming_function)
Similar to #3703, this makes setnames() even more convenient to use.
# Example
dt = data.table(x = 1:5, a_x = 10:14, a_y = runif(5), z = rnorm(5))
setnames(dt, patterns("^a|z"), toupper)
dt
x A_X A_Y Z
<int> <int> <num> <num>
1: 1 10 0.20489873 -0.5543310
2: 2 11 0.53906528 -0.8251313
3: 3 12 0.06511412 0.5853826
4: 4 13 0.03495321 0.8802074
5: 5 14 0.24168753 -0.5633140
One question with this is how patterns() would be used in setnames(). The two options that sprang to my mind:
- Matches from multiple patterns are concatenated, and only one renaming function may be provided.
- patterns in
setnames()operates similar tomelt(), where multiple patterns can be provided to match different names given in the value.name argument. The first pattern would match the first in a list of functions passed to new, and so on. If only one function was passed, the list would be concatenated or error, depending on preference.
- Ngôn ngữ chính
- R
- Star
- 3.9k
- Fork
- 1.1k
- Merge trung bình
- 14 giờ 4 phút
- Pull request đã merge (30 ngày)
- 4
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Rdatatable/data.table
-
as.data.table() recurses without end on a survival::Surv object (or any data.frame carrying one) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Rdatatable/data.table#7887 ·
-
consistency tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Rdatatable/data.table#7853 · 3 bình luận ·
-
internals
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Rdatatable/data.table#6938 · 1 bình luận ·
-
encoding fread
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Rdatatable/data.table#5179 · 8 bình luận ·
-
documentation programming
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Rdatatable/data.table#3199 · 3 bình luận ·
Tất cả issue của Rdatatable/data.table
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
r-lib/pkgdepends#485 · 3 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
beginners blocker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
enviPathR Đang mởBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Bioconductor/BiocContributions#207 · 6 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
datacarpentry/semester-biology#1255 ·