magrittr

    2熱度

    2回答

    我從dplyr使用%>%margritr奮力管的東西的功能過濾器內的另一個理由。 我會認爲這應該工作: library(dplyr) library(margritr) d <- data.frame(a=c(1,2,3),b=c(4,5,6)) c(2,2) %>% filter(d, a %in% .) 但我得到這個: # Error in UseMethod("filter_")

    0熱度

    1回答

    想這兩個功能結合起來: `dataframe %$% t.test(vector1, vector2, paired = T) dataframe %$% cohen.d.(vector1, vector2, paired = T)` 到的東西,需要data.frame只有一次這樣的: `dataframe %$% t.test(vector1, vector2

    3熱度

    1回答

    從(1)速度的角度來說,有沒有在R函數內部使用magrittr管是不利的情況,以及(2)有效調試的能力?

    1熱度

    1回答

    我要求的功能只是爲了編程時的方便。 使用「+」運算符在ggplot2中添加圖層非常棒。特別是在中間添加圖層只是添加另一行代碼。但是,如果我想在最後一行之後添加一個圖層,則必須在最後一行附加一個「+」,如果我想再次刪除此圖層,則還必須再次刪除「+」: ggplot(df, aes(x,y,...)) + geom_X(...) + # after this line, I can eas

    1熱度

    1回答

    我不清楚如何將函數應用於使用點(「。」)與magrittr數據的組件,如數據列或列表中的項目。 例子: > data.frame(x = 1:10, y = 11:20) %>% .$y [1] 11 12 13 14 15 16 17 18 19 20 似乎訪問數據應該工作一樣應用功能,但它並不: > data.frame(x = 1:10, y = 11:20) %>% min(.$y)

    2熱度

    3回答

    說我有一個數據集,我想使用管道語法幾個過濾器適用於它,像這樣: library(magrittr) library(dplyr) mtcars %<>% filter(cyl == 4) %>% select(cyl, mpg) nrow(mtcars) #[1] 11 我檢查的數據每個這樣的步驟後nrow設置的當前狀態,所以我以爲我可以覆蓋管道%<>%操作沿 `%

    7熱度

    1回答

    我試圖通過使用suppressWarnings()函數來取消警告。 令人驚訝的是,它會在正常使用時刪除警告,但在使用管道%>%運算符時會失敗。 下面是一些示例代碼: library(magrittr) c("1", "2", "ABC") %>% as.numeric() # [1] 1 2 NA # Warning message: # In function_list[[k]](va

    0熱度

    4回答

    這可能是一個簡單的問題,但我無法弄清楚答案。考慮一個簡單的數據幀 library(dplyr) library(purrr) library(magrittr) dataframe <- data_frame(id = c(1,2,3,4), text = c("this is a this", "this is another",'hello','what???'))

    0熱度

    1回答

    與此相關的問題裏面: Adding prefixes to some variables without touching others? 我嘗試這個解決辦法,但因爲我不知道發生了什麼事沒有分享: 數據: df1 <- data.frame("hea_income"=c(45000,23465,89522),"gea_property"=c(1,1,2) ,"win_state"=c("AB","

    2熱度

    1回答

    我正在拉一個.rda文件並加載數據。它工作正常,像這樣: library(magrittr) conn <- "http://www.mosaic-web.org/go/datasets/DCF/MeasTreatTables.rda" %>% url() load(conn) 但是當我使用整個管: "http://www.mosaic-web.org/go/datasets/D