• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#windowsobjective-ccocoaqtpython誰得phprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión3e3aabb1b1adc61c38d5cf6b3fdd9359c6078799 (tree)
Tiempo2023-01-20 02:36:12
AutorLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

I made some modifications to get ready for the new dplyr release.

Cambiar Resumen

Diferencia incremental

diff -r f1197b4cec50 -r 3e3aabb1b1ad R-codes/stat_lib.R
--- a/R-codes/stat_lib.R Thu Jan 19 11:00:17 2023 +0100
+++ b/R-codes/stat_lib.R Thu Jan 19 18:36:12 2023 +0100
@@ -2779,8 +2779,13 @@
27792779
27802780 ## res <- df %>% replace(., is.na(.), pattern)
27812781
2782+ ## res <- df |>
2783+ ## (\(x) replace(x, is.na(x), pattern))()
2784+
2785+
27822786 res <- df |>
2783- (\(x) replace(x, is.na(x), pattern))()
2787+ mutate(across(everything(),\(x) replace(x, is.na(x), pattern)))
2788+
27842789
27852790 return(res)
27862791
@@ -2834,13 +2839,18 @@
28342839
28352840 ## the other way around, consider a certain pattern as an NA
28362841
2842+## See https://github.com/tidyverse/dplyr/issues/6645#issuecomment-1397035215
2843+
28372844 pattern_to_na <- function(df, pattern){
28382845
28392846 ## res <- df %>% na_if(., pattern)
28402847
2841-res <- df |> (\(x) na_if(x, pattern))()
2842-
2843-
2848+## res <- df |> (\(x) na_if(x, pattern))()
2849+
2850+## across(where(is.character), \(x) na_if(x, "D"))
2851+
2852+ res <- df |>
2853+ mutate(across(where(is.character), \(x) na_if(x, pattern)))
28442854
28452855 return(res)
28462856
@@ -2856,8 +2866,12 @@
28562866
28572867 if (!is.na(pattern1)){
28582868
2859-res <- df |> (\(x) replace(x,x== pattern1, pattern2))()
2860-
2869+## res <- df |> (\(x) replace(x,x== pattern1, pattern2))()
2870+
2871+ res <- df |>
2872+ mutate(across(where(is.character), \(x) replace(x,x== pattern1, pattern2)))
2873+
2874+
28612875 } else{
28622876
28632877