我正在尝试聚集各种想法,每一个都作为参考。 每行包含一个想法,csv看起来像这样:
library(tm)
setwd("/Users/Bif/Documents")
#read the data
data<-read.csv("ideas.csv", header=T, sep=";")
> data
Reference idea
1 FI-000786 AIRE DE DETENTE LES BEAUX JOURS ARRIVENT etc…
2 FI-000754 Tiroirs de rangement des véhicules les tiroirs etc…
3 FI-000740 EVITER LES PI Vaines sur sur les dossiers MOAR etc..
4 FI-000717 Glossaire de sigleset trigrammes ucf beaucoup etc…
5 FI-000705 Transport de l'escabeau Bruit et accès de etc…
6 FI-000669 economie de papier C.Q.P (avis de passage avec etc…
7 FI-000653 UTILISATION D 'UNE CAMERA D'INSPECTION etc..
8 FI-000649 faciliter les déclarations de SD par les agents etc…
9 FI-000639 Récup Embase téléreport sur coffret Des coffrets etc…
我对R.很新。我一直在尝试使用文本挖掘tm-package,我可以通过DoumentTermMatrix分析第二列的术语频率,问题在于这个过程I& #39; m只能将其分析为纯文本,而不是我之后可以比较的不同文本组,并告诉哪些引用与其他引用相似。
我已经看到有qpad package topic可能接近我正在寻找的东西(即使我无法加载包装,也不知道为什么然而..)但我无法弄清楚如何将每个引用(链接示例中的日期)聚合在一起。
我在网上搜索了很多内容,我现在感到困惑......
非常感谢你。
答案 0 :(得分:0)
使用tm创建DocumentTermMatrix,然后将DocumentTermMatrix转换为带array(11) { [0]=> object(stdClass)#1 (7) { ["_links"]=> object(stdClass)#2 (4) { ["self"]=> object(stdClass)#3 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/394" } ["teams"]=> object(stdClass)#4 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/394/teams" } ["fixtures"]=> object(stdClass)#5 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/394/fixtures" } ["leagueTable"]=> object(stdClass)#6 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/394/leagueTable" } } ["caption"]=> string(21) "1. Bundesliga 2015/16" ["league"]=> string(3) "BL1" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(18) ["numberOfGames"]=> int(306) ["lastUpdated"]=> string(20) "2015-07-15T05:21:07Z" } [1]=> object(stdClass)#7 (7) { ["_links"]=> object(stdClass)#8 (4) { ["self"]=> object(stdClass)#9 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/395" } ["teams"]=> object(stdClass)#10 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/395/teams" } ["fixtures"]=> object(stdClass)#11 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/395/fixtures" } ["leagueTable"]=> object(stdClass)#12 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/395/leagueTable" } } ["caption"]=> string(21) "2. Bundesliga 2015/16" ["league"]=> string(3) "BL2" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(18) ["numberOfGames"]=> int(306) ["lastUpdated"]=> string(20) "2015-08-03T02:28:27Z" } [2]=> object(stdClass)#13 (7) { ["_links"]=> object(stdClass)#14 (4) { ["self"]=> object(stdClass)#15 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/396" } ["teams"]=> object(stdClass)#16 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/396/teams" } ["fixtures"]=> object(stdClass)#17 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/396/fixtures" } ["leagueTable"]=> object(stdClass)#18 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/396/leagueTable" } } ["caption"]=> string(15) "Ligue 1 2015/16" ["league"]=> string(3) "FL1" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(20) ["numberOfGames"]=> int(380) ["lastUpdated"]=> string(20) "2015-07-31T06:12:34Z" } [3]=> object(stdClass)#19 (7) { ["_links"]=> object(stdClass)#20 (4) { ["self"]=> object(stdClass)#21 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/397" } ["teams"]=> object(stdClass)#22 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/397/teams" } ["fixtures"]=> object(stdClass)#23 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/397/fixtures" } ["leagueTable"]=> object(stdClass)#24 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/397/leagueTable" } } ["caption"]=> string(15) "Ligue 2 2015/16" ["league"]=> string(3) "FL2" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(20) ["numberOfGames"]=> int(380) ["lastUpdated"]=> string(20) "2015-08-02T12:20:09Z" } [4]=> object(stdClass)#25 (7) { ["_links"]=> object(stdClass)#26 (4) { ["self"]=> object(stdClass)#27 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/398" } ["teams"]=> object(stdClass)#28 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/398/teams" } ["fixtures"]=> object(stdClass)#29 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/398/fixtures" } ["leagueTable"]=> object(stdClass)#30 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/398/leagueTable" } } ["caption"]=> string(22) "Premier League 2015/16" ["league"]=> string(2) "PL" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(20) ["numberOfGames"]=> int(380) ["lastUpdated"]=> string(20) "2015-07-31T06:02:18Z" } [5]=> object(stdClass)#31 (7) { ["_links"]=> object(stdClass)#32 (4) { ["self"]=> object(stdClass)#33 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/399" } ["teams"]=> object(stdClass)#34 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/399/teams" } ["fixtures"]=> object(stdClass)#35 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/399/fixtures" } ["leagueTable"]=> object(stdClass)#36 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/399/leagueTable" } } ["caption"]=> string(24) "Primera Division 2015/16" ["league"]=> string(2) "PD" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(20) ["numberOfGames"]=> int(380) ["lastUpdated"]=> string(20) "2015-07-15T05:27:20Z" } [6]=> object(stdClass)#37 (7) { ["_links"]=> object(stdClass)#38 (4) { ["self"]=> object(stdClass)#39 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/400" } ["teams"]=> object(stdClass)#40 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/400/teams" } ["fixtures"]=> object(stdClass)#41 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/400/fixtures" } ["leagueTable"]=> object(stdClass)#42 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/400/leagueTable" } } ["caption"]=> string(24) "Segunda Division 2015/16" ["league"]=> string(2) "SD" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(20) ["numberOfGames"]=> int(420) ["lastUpdated"]=> string(20) "2015-07-19T09:47:33Z" } [7]=> object(stdClass)#43 (7) { ["_links"]=> object(stdClass)#44 (4) { ["self"]=> object(stdClass)#45 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/401" } ["teams"]=> object(stdClass)#46 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/401/teams" } ["fixtures"]=> object(stdClass)#47 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/401/fixtures" } ["leagueTable"]=> object(stdClass)#48 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/401/leagueTable" } } ["caption"]=> string(15) "Serie A 2015/16" ["league"]=> string(2) "SA" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(20) ["numberOfGames"]=> int(380) ["lastUpdated"]=> string(20) "2015-07-31T06:00:43Z" } [8]=> object(stdClass)#49 (7) { ["_links"]=> object(stdClass)#50 (4) { ["self"]=> object(stdClass)#51 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/402" } ["teams"]=> object(stdClass)#52 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/402/teams" } ["fixtures"]=> object(stdClass)#53 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/402/fixtures" } ["leagueTable"]=> object(stdClass)#54 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/402/leagueTable" } } ["caption"]=> string(21) "Primeira Liga 2015/16" ["league"]=> string(3) "PPL" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(18) ["numberOfGames"]=> int(306) ["lastUpdated"]=> string(20) "2015-07-31T06:15:10Z" } [9]=> object(stdClass)#55 (7) { ["_links"]=> object(stdClass)#56 (4) { ["self"]=> object(stdClass)#57 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/403" } ["teams"]=> object(stdClass)#58 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/403/teams" } ["fixtures"]=> object(stdClass)#59 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/403/fixtures" } ["leagueTable"]=> object(stdClass)#60 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/403/leagueTable" } } ["caption"]=> string(21) "3. Bundesliga 2015/16" ["league"]=> string(3) "BL3" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(20) ["numberOfGames"]=> int(380) ["lastUpdated"]=> string(20) "2015-08-03T02:28:50Z" } [10]=> object(stdClass)#61 (7) { ["_links"]=> object(stdClass)#62 (4) { ["self"]=> object(stdClass)#63 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/404" } ["teams"]=> object(stdClass)#64 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/404/teams" } ["fixtures"]=> object(stdClass)#65 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/404/fixtures" } ["leagueTable"]=> object(stdClass)#66 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/404/leagueTable" } } ["caption"]=> string(18) "Eredivisie 2015/16" ["league"]=> string(3) "DED" ["year"]=> string(4) "2015" ["numberOfTeams"]=> int(18) ["numberOfGames"]=> int(306) ["lastUpdated"]=> string(20) "2015-08-03T02:34:21Z" } }
的DataFrame,然后将引用列cbind()返回到新数据框。或者,将转换后的DoctermMatrix( - &gt; DataFrame)重新绑定回原始数据框,以便进一步处理。