我構建了10篇論文的元數據。該dput()
結果介紹如下:「'到'缺少'在單獨的列(tidyr)
> dput(itemlist)
structure(list(title = c("錢學森工程科學思想的實踐者 [科普文章]",
"超高周疲勞裂紋萌生與初始擴展的特徵尺度 [科普文章]", "Proceedings of International conference on Airworthiness & Fatigue – 7th ICSAELS Series Conference [期刊論文]",
"一種熱機械疲勞實驗的裝置和方法 [專利]", "IUTAM和ICTAM的起源和歷程 [科普文章]",
"加載頻率對金屬材料超高周疲勞性能的影響 [會議論文]", "金屬材料超高周疲勞行爲的Monte-Carlo模擬 [會議論文]",
"Vibration behavior and response to an accidental collision of SFT prototype in Qiandao Lake (China) [會議論文]",
"A simulation on microstructure sensitivity to very-high-cycle fatigue behavior of metallic materials [會議論文]",
"Effect of traveling wave on vortex-induced vibrations of submerged floating tunnel tethers [會議論文]"
), publish = c("2014", "2014", " 2013", "專利類型: 發明專利, 專利號: ZL2009102374751, 申請日期: 2012, 公開日期: 2012-12-27",
"2012", "第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山",
"第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山", "The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10"
), author = c("丁雁生; 洪友士; 金和", "洪友士; 中國科學院老科技工作者協會工程力學分會",
"Sih G C; Hong YS(洪友士)", "謝季佳; 趙愛國; 武曉東; 洪友士",
"陳杰; 劉洋; 湯亞南; 洪友士", "趙愛國; 洪友士; 謝季佳", "雷錚強; 洪友士; 謝季佳; 趙愛國",
"Zhang SY(張雙寅); Wang L(王雷); Hong YS(洪友士)", "Lei ZQ(雷錚強); Xie JJ(謝季佳); Zhao AG(趙愛國); Hong YS(洪友士)",
"Wu XD(武曉東); Ge F(葛斐); Hong YS(洪友士)")), .Names = c("title",
"publish", "author"), row.names = c(NA, 10L), class = "data.frame")
我發現tidyr可以通過每個元素的一個屬性單獨的列表。在這個例子中,我「作者」分成不同的行:
> dput(itemlist_tidy)
structure(list(title = c("錢學森工程科學思想的實踐者 [科普文章]",
"錢學森工程科學思想的實踐者 [科普文章]", "錢學森工程科學思想的實踐者 [科普文章]",
"超高周疲勞裂紋萌生與初始擴展的特徵尺度 [科普文章]", "超高周疲勞裂紋萌生與初始擴展的特徵尺度 [科普文章]",
"Proceedings of International conference on Airworthiness & Fatigue – 7th ICSAELS Series Conference [期刊論文]",
"Proceedings of International conference on Airworthiness & Fatigue – 7th ICSAELS Series Conference [期刊論文]",
"一種熱機械疲勞實驗的裝置和方法 [專利]", "一種熱機械疲勞實驗的裝置和方法 [專利]",
"一種熱機械疲勞實驗的裝置和方法 [專利]", "一種熱機械疲勞實驗的裝置和方法 [專利]",
"IUTAM和ICTAM的起源和歷程 [科普文章]", "IUTAM和ICTAM的起源和歷程 [科普文章]",
"IUTAM和ICTAM的起源和歷程 [科普文章]", "IUTAM和ICTAM的起源和歷程 [科普文章]",
"加載頻率對金屬材料超高周疲勞性能的影響 [會議論文]", "加載頻率對金屬材料超高周疲勞性能的影響 [會議論文]",
"加載頻率對金屬材料超高周疲勞性能的影響 [會議論文]", "金屬材料超高周疲勞行爲的Monte-Carlo模擬 [會議論文]",
"金屬材料超高周疲勞行爲的Monte-Carlo模擬 [會議論文]", "金屬材料超高周疲勞行爲的Monte-Carlo模擬 [會議論文]",
"金屬材料超高周疲勞行爲的Monte-Carlo模擬 [會議論文]", "Vibration behavior and response to an accidental collision of SFT prototype in Qiandao Lake (China) [會議論文]",
"Vibration behavior and response to an accidental collision of SFT prototype in Qiandao Lake (China) [會議論文]",
"Vibration behavior and response to an accidental collision of SFT prototype in Qiandao Lake (China) [會議論文]",
"A simulation on microstructure sensitivity to very-high-cycle fatigue behavior of metallic materials [會議論文]",
"A simulation on microstructure sensitivity to very-high-cycle fatigue behavior of metallic materials [會議論文]",
"A simulation on microstructure sensitivity to very-high-cycle fatigue behavior of metallic materials [會議論文]",
"A simulation on microstructure sensitivity to very-high-cycle fatigue behavior of metallic materials [會議論文]",
"Effect of traveling wave on vortex-induced vibrations of submerged floating tunnel tethers [會議論文]",
"Effect of traveling wave on vortex-induced vibrations of submerged floating tunnel tethers [會議論文]",
"Effect of traveling wave on vortex-induced vibrations of submerged floating tunnel tethers [會議論文]"
), publish = c("2014", "2014", "2014", "2014", "2014", " 2013",
" 2013", "專利類型: 發明專利, 專利號: ZL2009102374751, 申請日期: 2012, 公開日期: 2012-12-27",
"專利類型: 發明專利, 專利號: ZL2009102374751, 申請日期: 2012, 公開日期: 2012-12-27",
"專利類型: 發明專利, 專利號: ZL2009102374751, 申請日期: 2012, 公開日期: 2012-12-27",
"專利類型: 發明專利, 專利號: ZL2009102374751, 申請日期: 2012, 公開日期: 2012-12-27",
"2012", "2012", "2012", "2012", "第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山",
"第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山", "第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山",
"第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山", "第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山",
"第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山", "第十五屆全國疲勞與斷裂學術會議摘要及論文集, 中國廣東佛山",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10",
"The 1st International Symposium on Archimedes Bridge, Qiandao Lake, China, 2010-10"
), author = c("丁雁生", " 洪友士", " 金和", "洪友士", " 中國科學院老科技工作者協會工程力學分會",
"Sih G C", " Hong YS(洪友士)", "謝季佳", " 趙愛國", " 武曉東",
" 洪友士", "陳杰", " 劉洋", " 湯亞南", " 洪友士", "趙愛國", " 洪友士",
" 謝季佳", "雷錚強", " 洪友士", " 謝季佳", " 趙愛國", "Zhang SY(張雙寅)",
" Wang L(王雷)", " Hong YS(洪友士)", "Lei ZQ(雷錚強)", " Xie JJ(謝季佳)",
" Zhao AG(趙愛國)", " Hong YS(洪友士)", "Wu XD(武曉東)", " Ge F(葛斐)",
" Hong YS(洪友士)")), row.names = c(NA, -32L), class = "data.frame", .Names = c("title",
"publish", "author"))
我關注的是「作者」一欄:
- 所有作者用分號分開的(「;」)
- 不是所有的論文都有相同數量的作者。
現在,我想分離「作者」列到各個欄目中,以便通過igraph繪製合着者圖。看來「tidyr」的最佳選擇,但它不能正常工作:
> library(tidyr)
> v_t <- separate(itemlist, col="author", sep = ";", remove = TRUE, convert = FALSE)
Error in simplifyPieces(pieces, n, fill == "left") :
argument "into" is missing, with no default
我不明白的錯誤信息恰恰意味着。我們需要滿足什麼條件才能將「作者」分成許多列。我認爲,由於tidyr提供了分隔行或列的功能,它必須是分離使用這些表的方法。我們應該意識到嗎?
感謝。我誤解了參數「into」,你在上面發佈的例子比手冊更清晰。感謝您的幫助。 –