tidyverse

    0熱度

    2回答

    我想保存到磁盤tibble有列表列(稍後在R中使用)。理想情況下,我想喜歡feather快速二進制格式,但是,它似乎並不支持列表中的cols: test <- tibble(a= list(c(1,2), c(3,4))) feather::write_feather(test, 'test.csv') Error in writeFeather(x, path) : Not impleme

    3熱度

    1回答

    我想創建一個雙嵌套數據結構,其中c嵌套在一個嵌套在id中的嵌套數據結構中。 library(tidyverse) m<-data_frame(id=c(100,101,100,101,100,101,100,101), a=c("A","A","B","B","A","A","D","D"), c=c(1:8)) m2 <- m %>% group_by(id)

    1熱度

    1回答

    我有一個數據框,其中包含調查響應,每行代表不同的人。一列 - 「文本」 - 是一個開放式的文本問題。我想用Tidytext :: unnest_tokens讓我通過每行做文本分析,包括景氣指數,字數等 下面是這個例子中,簡單的數據框: Satisfaction<-c ("Satisfied","Satisfied","Dissatisfied","Satisfied","Dissatisfied"

    6熱度

    1回答

    我想使用tidyverse和modelr軟件包計算一組數據的邏輯迴歸預測。很顯然,我在add_predictions中做錯了,因爲我沒有收到邏輯函數的「響應」,就像我在統計中使用「預測」函數一樣。這應該很簡單,但我無法弄清楚,多次搜索的結果都很少。 library(tidyverse) library(modelr) options(na.action = na.warn) library(

    1熱度

    1回答

    我承認這是一個很差的問題標題,但我無法想出適當的標題,因爲我不太確定我在這裏要做什麼處理: 我有一個數據幀,看起來像這樣:降低下列方式中的數據 df <- data.frame( location = rep(LETTERS[1:4], each = 3), organisation = rep(1:6, each = 2), project = rep(le

    -1熱度

    1回答

    我不喜歡dplyr和data.table在我的data.frame上創建一個新變量並決定比較方法。 令我驚訝的是,將dplyr :: mutate()的結果重新分配給新的data.frame似乎比不這樣做更快。 這是怎麼發生的? library(data.table) library(tidyverse) dt <- fread(".... data.csv") #load 200MB d

    0熱度

    1回答

    我想創建一個dplyr::bind_rows suped式版本,避免Unequal factor levels: coercing to character警告,當係數列存在於我們試圖結合DFS(也可能產生非要素列)。這裏有一個例子: df1 <- dplyr::data_frame(age = 1:3, gender = factor(c("male", "female", "female"))

    1熱度

    3回答

    我有一個整潔數據在Introducing tidyr blog post設置類似於聽到率的例子,但我有藥物下一個額外的「安慰劑」基團,我可以構造這樣 library(dplyr) library(tidyr) messy <- data.frame( name = c("Wilbur", "Petunia", "Gregory"), a = c(67, 80, 64),

    1熱度

    2回答

    我正在使用tidytext(和tidyverse)分析一些文本數據(如Tidy Text Mining with R)。 我輸入的文本文件,myfile.txt,看起來是這樣的: # Section 1 Name Lorem ipsum dolor sit amet ... (et cetera) # Section 2 Name <multiple lines here again>

    0熱度

    1回答

    library(ggmosaic) library(dplyr) library(purrr) library(tidyr) library(broom) library(tibble) 使用下面的代碼,我想功能,同時輸出整潔tibble還有ggplot。我不確定如何使用函數內的「返回」來返回多個事物。 我想這樣的事情... Chifun<-function(var){ df<-h