Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Question]: Making easier to add piped expression to qenv

Đang mở
#369 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
r
Lĩnh vực
data

Hướng nghiên cứu

Bắt đầu bằng cách so sánh cách các API qenv và within hiện có thu nhận và xác thực các biểu thức, cũng như cách get_code render chúng. Xem xét workflow add_pipe được đề xuất và tương tác của nó với teal_data. Được xem là hoàn tất khi có thể nối thêm một pipe chưa hoàn chỉnh và tiếp tục nó qua nhiều lần gọi, trong khi việc xác thực được trì hoãn cho đến khi biểu thức kết thúc.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

core question
What is your question?

With within is very easy to add a complete expression to qenv.

The pipe has the benefit of reducing the allocation of variables and removing a parameter as is passed implicitly and potentially make code more readable.
R users use/expect pipes (%>% and |> mostly) and often they are created step by step.
If the piped expression is not completed it results in an error, so module developers need to write first the complete expression and then add it to the qenv/teal_data:

library("qenv")
q <- within(qenv(), {
  p <- penguins
})

within(q, {
  p %>% 
    subset(!is.na(sex)) %>% 
})
#> Error: unexpected '}' in:
#> "    subset(!is.na(sex)) %>% 
#> }"

It would be great if there were some method/function to be able to append an incomplete piped expression to be continued.
An idea:

q2 <- add_pipe(q, {p <- p %>% subset(!is.na(sex))}, pipe = "%>%")
cat(get_code(q2))
#> p <- penguins
#> p<- p %>% subset(!is.na(sex)) %>% { }

q3 <- add_pipe(q2, {head()}, pipe = "")
cat(get_code(q3))
#> p <- penguins
#> p <- p %>% subset(!is.na(sex)) %>% head()

Adding an empty character instead of the (default?) pipe could signal the end of the pipeable expression.
Only then the code would be verified.

Code of Conduct
  • I agree to follow this project's Code of Conduct.
Contribution Guidelines
  • I agree to follow this project's Contribution Guidelines.
Security Policy
  • I agree to follow this project's Security Policy.
Ngôn ngữ chính
R
Star
11
Fork
9
Merge trung bình
6 ngày 2 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của insightsengineering/teal.data

Tất cả issue của insightsengineering/teal.data

Issue tương tự

Thêm issue về R

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.