R语言 基于滞后列的数据集排序

3z6pesqy  于 2023-03-05  发布在  其他
关注(0)|答案(1)|浏览(144)

我有下面的数据框。我试图为每个唯一的日类型-方向组合创建一个序列,以了解点的顺序(这意味着形成一条线)。然而,数据集中的点的顺序没有得到维护。

我知道'Latitude(to)'和'Longitude(to)'列给予了下一个点的坐标,所以我应该能够将当前点的下一个(to)坐标与下一个点的(from)坐标匹配起来,以创建一个序列变量。
我所知道的唯一方法是循环遍历组中的所有行,匹配行以对其进行排序,然后创建一个序列。有没有更有效的方法来实现这一点?

structure(list(`Day Type` = c("Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", 
"Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", 
"Saturday"), Direction = c("1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "2", "2", 
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", 
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", 
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2", 
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", 
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", 
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", 
"2", "2", "2", "2", "2", "2", "2"), `Latitude (from)` = c("1.28210155945393", 
"1.28329993019059", "1.28394108576437", "1.28475980959972", "1.284977", 
"1.28572048365401", "1.28583847140468", "1.28593135445772", "1.28623157720487", 
"1.28723833324362", "1.28736808047078", "1.29078162052352", "1.293615", 
"1.29395444170081", "1.2950426189642", "1.295962316986", "1.29618544092334", 
"1.29796011528522", "1.29811014243867", "1.29831153783592", "1.29986928715834", 
"1.30027569326586", "1.30044251755834", "1.30070547633658", "1.302127", 
"1.30252834773643", "1.304086", "1.30425500081318", "1.30496423786628", 
"1.30528972611328", "1.30566306799291", "1.30595638898755", "1.30674381370885", 
"1.30711835522323", "1.3071917122941", "1.30726086825664", "1.30787614366531", 
"1.30821308595952", "1.30837865741776", "1.30851455788092", "1.30862937328019", 
"1.30938972202558", "1.30943460005849", "1.31135799079971", "1.31250502315071", 
"1.31295810131062", "1.31390444400831", "1.31656999665769", "1.31875790465263", 
"1.32132832560695", "1.32453874317344", "1.28210155945393", "1.28362333298689", 
"1.28420923932422", "1.28484639603431", "1.28599961406266", "1.28606797463712", 
"1.28675501760897", "1.28685859481289", "1.28722333302937", "1.28837086415387", 
"1.29152472200833", "1.29409221679274", "1.29452091230981", "1.296265", 
"1.29647916306741", "1.29763682834545", "1.29821382250893", "1.29930997279734", 
"1.30032715605093", "1.3004785730821", "1.30154262450563", "1.302461", 
"1.30386684425114", "1.30438002120698", "1.30461834682389", "1.3047647219741", 
"1.30585304722559", "1.3067937735779", "1.30712803633755", "1.3074963710946", 
"1.30751338586806", "1.30751703730041", "1.30803621256234", "1.30822971200422", 
"1.30845544825732", "1.30867772794032", "1.30913166702397", "1.30955979607535", 
"1.30965150589688", "1.31088501240237", "1.31293014528666", "1.31342707975776", 
"1.31398835332345", "1.31664972197451", "1.31848306586196", "1.3214133317439", 
"1.32453874317344", "1.28210155945393", "1.28329993019059", "1.28394108576437", 
"1.28475980959972", "1.284977", "1.28572048365401", "1.28583847140468", 
"1.28593135445772", "1.28623157720487", "1.28723833324362", "1.28736808047078", 
"1.29078162052352", "1.293615", "1.29395444170081", "1.2950426189642", 
"1.295962316986", "1.29618544092334", "1.29796011528522", "1.29811014243867", 
"1.29831153783592", "1.29986928715834", "1.30027569326586", "1.30044251755834", 
"1.30070547633658", "1.302127", "1.30252834773643", "1.304086", 
"1.30425500081318", "1.30496423786628", "1.30528972611328", "1.30566306799291", 
"1.30595638898755", "1.30674381370885", "1.30711835522323", "1.3071917122941", 
"1.30726086825664", "1.30787614366531", "1.30821308595952", "1.30837865741776", 
"1.30851455788092", "1.30862937328019", "1.30938972202558", "1.30943460005849", 
"1.31135799079971", "1.31250502315071", "1.31295810131062", "1.31390444400831", 
"1.31656999665769", "1.31875790465263", "1.32132832560695", "1.32453874317344", 
"1.28210155945393", "1.28362333298689", "1.28420923932422", "1.28484639603431", 
"1.28599961406266", "1.28606797463712", "1.28675501760897", "1.28685859481289", 
"1.28722333302937", "1.28837086415387", "1.29152472200833", "1.29409221679274", 
"1.29452091230981", "1.296265", "1.29647916306741", "1.29763682834545", 
"1.29821382250893", "1.29930997279734", "1.30032715605093", "1.3004785730821", 
"1.30154262450563", "1.302461", "1.30386684425114", "1.30438002120698", 
"1.30461834682389", "1.3047647219741", "1.30585304722559", "1.3067937735779", 
"1.30712803633755", "1.3074963710946", "1.30751338586806", "1.30751703730041", 
"1.30803621256234", "1.30822971200422", "1.30845544825732", "1.30867772794032", 
"1.30913166702397", "1.30955979607535", "1.30965150589688", "1.31088501240237", 
"1.31293014528666", "1.31342707975776", "1.31398835332345", "1.31664972197451", 
"1.31848306586196", "1.3214133317439", "1.32453874317344"), `Longitude (from)` = c("103.81722480263163", 
"103.81547665017668", "103.81783962251122", "103.83405671725487", 
"103.821011", "103.8285292287095", "103.83238179897589", "103.82668969231534", 
"103.83496162445665", "103.82259298997768", "103.82346004890803", 
"103.83440916705554", "103.832759", "103.85139096636622", "103.83205533028763", 
"103.85795174896221", "103.84958029974611", "103.83053183555204", 
"103.84780636909545", "103.8452569595532", "103.84093746088925", 
"103.83877618459663", "103.83623804216019", "103.86336013257065", 
"103.829875", "103.83239784275958", "103.907533", "103.9123223933556", 
"103.91493558885941", "103.90534997934479", "103.9110051545323", 
"103.91698861102066", "103.875264139574", "103.87989373246151", 
"103.91764721757994", "103.88490711001795", "103.92111718654822", 
"103.88850877408412", "103.90304313394574", "103.92471047692146", 
"103.8906311270188", "103.89936888898059", "103.8966101212743", 
"103.92481225868325", "103.9250247698478", "103.92790605020116", 
"103.93171138898548", "103.93334015990408", "103.93158674239623", 
"103.92782177344944", "103.92903818515839", "103.81722480263163", 
"103.81472833301791", "103.81765723225827", "103.82059301467888", 
"103.82748123930962", "103.83283384311112", "103.82204990181914", 
"103.83360028266564", "103.82395833301354", "103.83349881780524", 
"103.83222750001508", "103.8308377640795", "103.85402155505173", 
"103.857666", "103.85147164487202", "103.82997986347917", "103.84936128375956", 
"103.84529021429745", "103.8624541086332", "103.84184700607595", 
"103.83852481842337", "103.8297819", "103.83413070051408", "103.91266110940761", 
"103.90783296450577", "103.90592361097", "103.91059595623031", 
"103.91498055803811", "103.87548108759093", "103.8798058337351", 
"103.91754269765207", "103.88500750064323", "103.90349800941955", 
"103.92151900444857", "103.88847214403829", "103.92426998119757", 
"103.89180000002517", "103.90034889101835", "103.8965764453886", 
"103.92498850824487", "103.92634861688488", "103.92903327944508", 
"103.93157431388184", "103.93304055596909", "103.93156320282378", 
"103.92757312069912", "103.92903818515839", "103.81722480263163", 
"103.81547665017668", "103.81783962251122", "103.83405671725487", 
"103.821011", "103.8285292287095", "103.83238179897589", "103.82668969231534", 
"103.83496162445665", "103.82259298997768", "103.82346004890803", 
"103.83440916705554", "103.832759", "103.85139096636622", "103.83205533028763", 
"103.85795174896221", "103.84958029974611", "103.83053183555204", 
"103.84780636909545", "103.8452569595532", "103.84093746088925", 
"103.83877618459663", "103.83623804216019", "103.86336013257065", 
"103.829875", "103.83239784275958", "103.907533", "103.9123223933556", 
"103.91493558885941", "103.90534997934479", "103.9110051545323", 
"103.91698861102066", "103.875264139574", "103.87989373246151", 
"103.91764721757994", "103.88490711001795", "103.92111718654822", 
"103.88850877408412", "103.90304313394574", "103.92471047692146", 
"103.8906311270188", "103.89936888898059", "103.8966101212743", 
"103.92481225868325", "103.9250247698478", "103.92790605020116", 
"103.93171138898548", "103.93334015990408", "103.93158674239623", 
"103.92782177344944", "103.92903818515839", "103.81722480263163", 
"103.81472833301791", "103.81765723225827", "103.82059301467888", 
"103.82748123930962", "103.83283384311112", "103.82204990181914", 
"103.83360028266564", "103.82395833301354", "103.83349881780524", 
"103.83222750001508", "103.8308377640795", "103.85402155505173", 
"103.857666", "103.85147164487202", "103.82997986347917", "103.84936128375956", 
"103.84529021429745", "103.8624541086332", "103.84184700607595", 
"103.83852481842337", "103.8297819", "103.83413070051408", "103.91266110940761", 
"103.90783296450577", "103.90592361097", "103.91059595623031", 
"103.91498055803811", "103.87548108759093", "103.8798058337351", 
"103.91754269765207", "103.88500750064323", "103.90349800941955", 
"103.92151900444857", "103.88847214403829", "103.92426998119757", 
"103.89180000002517", "103.90034889101835", "103.8965764453886", 
"103.92498850824487", "103.92634861688488", "103.92903327944508", 
"103.93157431388184", "103.93304055596909", "103.93156320282378", 
"103.92757312069912", "103.92903818515839"), `Latitude (to)` = c("-", 
"1.28210155945393", "1.28329993019059", "1.28583847140468", "1.28394108576437", 
"1.28593135445772", "1.28572048365401", "1.28736808047078", "1.28475980959972", 
"1.284977", "1.28723833324362", "1.28623157720487", "1.29078162052352", 
"1.29618544092334", "1.293615", "1.29395444170081", "1.29811014243867", 
"1.2950426189642", "1.29831153783592", "1.29986928715834", "1.30027569326586", 
"1.30044251755834", "1.30252834773643", "1.295962316986", "1.29796011528522", 
"1.302127", "1.30528972611328", "1.30566306799291", "1.30425500081318", 
"1.30837865741776", "1.304086", "1.30496423786628", "1.30070547633658", 
"1.30674381370885", "1.30595638898755", "1.30711835522323", "1.3071917122941", 
"1.30726086825664", "1.30938972202558", "1.30787614366531", "1.30821308595952", 
"1.30943460005849", "1.30862937328019", "1.30851455788092", "1.31135799079971", 
"1.31250502315071", "1.31295810131062", "1.31390444400831", "1.31656999665769", 
"1.31875790465263", "1.32132832560695", "1.28362333298689", "1.28420923932422", 
"1.28484639603431", "1.28675501760897", "1.28606797463712", "1.28685859481289", 
"1.28722333302937", "1.28837086415387", "1.28599961406266", "1.29152472200833", 
"1.29409221679274", "1.29763682834545", "1.296265", "1.30032715605093", 
"1.29452091230981", "1.302461", "1.29647916306741", "1.29821382250893", 
"1.30712803633755", "1.29930997279734", "1.3004785730821", "1.30386684425114", 
"1.30154262450563", "1.3067937735779", "1.30585304722559", "1.30461834682389", 
"1.30438002120698", "1.30751338586806", "1.3074963710946", "1.30751703730041", 
"1.30822971200422", "1.30845544825732", "1.3047647219741", "1.30867772794032", 
"1.30913166702397", "1.31088501240237", "1.30965150589688", "1.30803621256234", 
"1.30955979607535", "1.31293014528666", "1.31342707975776", "1.31398835332345", 
"1.31664972197451", "1.31848306586196", "1.3214133317439", "1.32453874317344", 
"-", "-", "1.28210155945393", "1.28329993019059", "1.28583847140468", 
"1.28394108576437", "1.28593135445772", "1.28572048365401", "1.28736808047078", 
"1.28475980959972", "1.284977", "1.28723833324362", "1.28623157720487", 
"1.29078162052352", "1.29618544092334", "1.293615", "1.29395444170081", 
"1.29811014243867", "1.2950426189642", "1.29831153783592", "1.29986928715834", 
"1.30027569326586", "1.30044251755834", "1.30252834773643", "1.295962316986", 
"1.29796011528522", "1.302127", "1.30528972611328", "1.30566306799291", 
"1.30425500081318", "1.30837865741776", "1.304086", "1.30496423786628", 
"1.30070547633658", "1.30674381370885", "1.30595638898755", "1.30711835522323", 
"1.3071917122941", "1.30726086825664", "1.30938972202558", "1.30787614366531", 
"1.30821308595952", "1.30943460005849", "1.30862937328019", "1.30851455788092", 
"1.31135799079971", "1.31250502315071", "1.31295810131062", "1.31390444400831", 
"1.31656999665769", "1.31875790465263", "1.32132832560695", "1.28362333298689", 
"1.28420923932422", "1.28484639603431", "1.28675501760897", "1.28606797463712", 
"1.28685859481289", "1.28722333302937", "1.28837086415387", "1.28599961406266", 
"1.29152472200833", "1.29409221679274", "1.29763682834545", "1.296265", 
"1.30032715605093", "1.29452091230981", "1.302461", "1.29647916306741", 
"1.29821382250893", "1.30712803633755", "1.29930997279734", "1.3004785730821", 
"1.30386684425114", "1.30154262450563", "1.3067937735779", "1.30585304722559", 
"1.30461834682389", "1.30438002120698", "1.30751338586806", "1.3074963710946", 
"1.30751703730041", "1.30822971200422", "1.30845544825732", "1.3047647219741", 
"1.30867772794032", "1.30913166702397", "1.31088501240237", "1.30965150589688", 
"1.30803621256234", "1.30955979607535", "1.31293014528666", "1.31342707975776", 
"1.31398835332345", "1.31664972197451", "1.31848306586196", "1.3214133317439", 
"1.32453874317344", "-"), `Longitude (to)` = c("-", "103.81722480263163", 
"103.81547665017668", "103.83238179897589", "103.81783962251122", 
"103.82668969231534", "103.8285292287095", "103.82346004890803", 
"103.83405671725487", "103.821011", "103.82259298997768", "103.83496162445665", 
"103.83440916705554", "103.84958029974611", "103.832759", "103.85139096636622", 
"103.84780636909545", "103.83205533028763", "103.8452569595532", 
"103.84093746088925", "103.83877618459663", "103.83623804216019", 
"103.83239784275958", "103.85795174896221", "103.83053183555204", 
"103.829875", "103.90534997934479", "103.9110051545323", "103.9123223933556", 
"103.90304313394574", "103.907533", "103.91493558885941", "103.86336013257065", 
"103.875264139574", "103.91698861102066", "103.87989373246151", 
"103.91764721757994", "103.88490711001795", "103.89936888898059", 
"103.92111718654822", "103.88850877408412", "103.8966101212743", 
"103.8906311270188", "103.92471047692146", "103.92481225868325", 
"103.9250247698478", "103.92790605020116", "103.93171138898548", 
"103.93334015990408", "103.93158674239623", "103.92782177344944", 
"103.81472833301791", "103.81765723225827", "103.82059301467888", 
"103.82204990181914", "103.83283384311112", "103.83360028266564", 
"103.82395833301354", "103.83349881780524", "103.82748123930962", 
"103.83222750001508", "103.8308377640795", "103.82997986347917", 
"103.857666", "103.8624541086332", "103.85402155505173", "103.8297819", 
"103.85147164487202", "103.84936128375956", "103.87548108759093", 
"103.84529021429745", "103.84184700607595", "103.83413070051408", 
"103.83852481842337", "103.91498055803811", "103.91059595623031", 
"103.90783296450577", "103.91266110940761", "103.91754269765207", 
"103.8798058337351", "103.88500750064323", "103.92151900444857", 
"103.88847214403829", "103.90592361097", "103.92426998119757", 
"103.89180000002517", "103.92498850824487", "103.8965764453886", 
"103.90349800941955", "103.90034889101835", "103.92634861688488", 
"103.92903327944508", "103.93157431388184", "103.93304055596909", 
"103.93156320282378", "103.92757312069912", "103.92903818515839", 
"-", "-", "103.81722480263163", "103.81547665017668", "103.83238179897589", 
"103.81783962251122", "103.82668969231534", "103.8285292287095", 
"103.82346004890803", "103.83405671725487", "103.821011", "103.82259298997768", 
"103.83496162445665", "103.83440916705554", "103.84958029974611", 
"103.832759", "103.85139096636622", "103.84780636909545", "103.83205533028763", 
"103.8452569595532", "103.84093746088925", "103.83877618459663", 
"103.83623804216019", "103.83239784275958", "103.85795174896221", 
"103.83053183555204", "103.829875", "103.90534997934479", "103.9110051545323", 
"103.9123223933556", "103.90304313394574", "103.907533", "103.91493558885941", 
"103.86336013257065", "103.875264139574", "103.91698861102066", 
"103.87989373246151", "103.91764721757994", "103.88490711001795", 
"103.89936888898059", "103.92111718654822", "103.88850877408412", 
"103.8966101212743", "103.8906311270188", "103.92471047692146", 
"103.92481225868325", "103.9250247698478", "103.92790605020116", 
"103.93171138898548", "103.93334015990408", "103.93158674239623", 
"103.92782177344944", "103.81472833301791", "103.81765723225827", 
"103.82059301467888", "103.82204990181914", "103.83283384311112", 
"103.83360028266564", "103.82395833301354", "103.83349881780524", 
"103.82748123930962", "103.83222750001508", "103.8308377640795", 
"103.82997986347917", "103.857666", "103.8624541086332", "103.85402155505173", 
"103.8297819", "103.85147164487202", "103.84936128375956", "103.87548108759093", 
"103.84529021429745", "103.84184700607595", "103.83413070051408", 
"103.83852481842337", "103.91498055803811", "103.91059595623031", 
"103.90783296450577", "103.91266110940761", "103.91754269765207", 
"103.8798058337351", "103.88500750064323", "103.92151900444857", 
"103.88847214403829", "103.90592361097", "103.92426998119757", 
"103.89180000002517", "103.92498850824487", "103.8965764453886", 
"103.90349800941955", "103.90034889101835", "103.92634861688488", 
"103.92903327944508", "103.93157431388184", "103.93304055596909", 
"103.93156320282378", "103.92757312069912", "103.92903818515839", 
"-"), sequence = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 
25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 
38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 
51L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 
14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 
27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 
40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 1L, 2L, 3L, 4L, 5L, 6L, 
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 
20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 
33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 
46L, 47L, 48L, 49L, 50L, 51L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 
9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 
22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 
35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L
)), row.names = c(NA, -196L), class = c("tbl_df", "tbl", "data.frame"
))
lndjwyie

lndjwyie1#

使用igraph和最新的dplyr(〉= 1.1.0)。
对于to/from坐标字符串匹配,我们可以组合lat/lon并创建2列to & from,这恰好适合igraph作为边列表。帮助函数首先检测结束节点(具有单条边的节点)并找到这些节点之间的路径。得到的节点顺序用于重新排列分组点。

library(dplyr)
library(ggplot2)
library(sf)
library(igraph)

# input df columns must have (to, from, sequence) columns
# create graph, find end points, those two with degree of 1 
# create shortest path between 2 end points, collect edges
# find current sequence value positions in shortest path, the new sorting order  
path_seq <- function(d){
  g  <- graph_from_data_frame(d)
  deg  <- degree(g)
  endpoints <- which(deg == 1)
  sp <- shortest_paths(g, endpoints[1], endpoints[2], output = "epath")$epath[[1]]
  match(edge_attr(g, "sequence"), sp)
}

df_arranged <- df %>% mutate( from = paste(`Latitude (from)`,`Longitude (from)`),
                              to   = paste(`Latitude (to)`,`Longitude (to)`)) %>% 
  mutate(path_seq = path_seq(pick(from, to, sequence)), .by = c(`Day Type`, Direction)) %>% 
  arrange(`Day Type`, Direction, path_seq)

# visual check
sf_points <-  st_as_sf(df_arranged, coords = c("Longitude (from)", "Latitude (from)"), crs = "WGS84")
sf_lines  <-  sf_points %>% 
  group_by(`Day Type`, Direction) %>% 
  summarise(do_union = FALSE, ) %>% 
  st_cast("LINESTRING")

ggplot() +
  geom_sf(data = sf_points, aes(color = Direction), alpha = .8) +
  geom_sf(data = sf_lines, aes(color = Direction), alpha = .8) +
  theme_bw()

创建于2023年2月28日,使用reprex v2.0.2
示例数据:

df <- structure(list(`Day Type` = c(
  "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Weekday",
  "Weekday", "Weekday", "Weekday", "Weekday", "Weekday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday", "Saturday", "Saturday", "Saturday", "Saturday", "Saturday",
  "Saturday"
), Direction = c(
  "1", "1", "1", "1", "1", "1", "1",
  "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
  "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
  "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
  "1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "2", "2",
  "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
  "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
  "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
  "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
  "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
  "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
  "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2",
  "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
  "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
  "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
  "2", "2", "2", "2", "2", "2", "2"
), `Latitude (from)` = c(
  "1.28210155945393",
  "1.28329993019059", "1.28394108576437", "1.28475980959972", "1.284977",
  "1.28572048365401", "1.28583847140468", "1.28593135445772", "1.28623157720487",
  "1.28723833324362", "1.28736808047078", "1.29078162052352", "1.293615",
  "1.29395444170081", "1.2950426189642", "1.295962316986", "1.29618544092334",
  "1.29796011528522", "1.29811014243867", "1.29831153783592", "1.29986928715834",
  "1.30027569326586", "1.30044251755834", "1.30070547633658", "1.302127",
  "1.30252834773643", "1.304086", "1.30425500081318", "1.30496423786628",
  "1.30528972611328", "1.30566306799291", "1.30595638898755", "1.30674381370885",
  "1.30711835522323", "1.3071917122941", "1.30726086825664", "1.30787614366531",
  "1.30821308595952", "1.30837865741776", "1.30851455788092", "1.30862937328019",
  "1.30938972202558", "1.30943460005849", "1.31135799079971", "1.31250502315071",
  "1.31295810131062", "1.31390444400831", "1.31656999665769", "1.31875790465263",
  "1.32132832560695", "1.32453874317344", "1.28210155945393", "1.28362333298689",
  "1.28420923932422", "1.28484639603431", "1.28599961406266", "1.28606797463712",
  "1.28675501760897", "1.28685859481289", "1.28722333302937", "1.28837086415387",
  "1.29152472200833", "1.29409221679274", "1.29452091230981", "1.296265",
  "1.29647916306741", "1.29763682834545", "1.29821382250893", "1.29930997279734",
  "1.30032715605093", "1.3004785730821", "1.30154262450563", "1.302461",
  "1.30386684425114", "1.30438002120698", "1.30461834682389", "1.3047647219741",
  "1.30585304722559", "1.3067937735779", "1.30712803633755", "1.3074963710946",
  "1.30751338586806", "1.30751703730041", "1.30803621256234", "1.30822971200422",
  "1.30845544825732", "1.30867772794032", "1.30913166702397", "1.30955979607535",
  "1.30965150589688", "1.31088501240237", "1.31293014528666", "1.31342707975776",
  "1.31398835332345", "1.31664972197451", "1.31848306586196", "1.3214133317439",
  "1.32453874317344", "1.28210155945393", "1.28329993019059", "1.28394108576437",
  "1.28475980959972", "1.284977", "1.28572048365401", "1.28583847140468",
  "1.28593135445772", "1.28623157720487", "1.28723833324362", "1.28736808047078",
  "1.29078162052352", "1.293615", "1.29395444170081", "1.2950426189642",
  "1.295962316986", "1.29618544092334", "1.29796011528522", "1.29811014243867",
  "1.29831153783592", "1.29986928715834", "1.30027569326586", "1.30044251755834",
  "1.30070547633658", "1.302127", "1.30252834773643", "1.304086",
  "1.30425500081318", "1.30496423786628", "1.30528972611328", "1.30566306799291",
  "1.30595638898755", "1.30674381370885", "1.30711835522323", "1.3071917122941",
  "1.30726086825664", "1.30787614366531", "1.30821308595952", "1.30837865741776",
  "1.30851455788092", "1.30862937328019", "1.30938972202558", "1.30943460005849",
  "1.31135799079971", "1.31250502315071", "1.31295810131062", "1.31390444400831",
  "1.31656999665769", "1.31875790465263", "1.32132832560695", "1.32453874317344",
  "1.28210155945393", "1.28362333298689", "1.28420923932422", "1.28484639603431",
  "1.28599961406266", "1.28606797463712", "1.28675501760897", "1.28685859481289",
  "1.28722333302937", "1.28837086415387", "1.29152472200833", "1.29409221679274",
  "1.29452091230981", "1.296265", "1.29647916306741", "1.29763682834545",
  "1.29821382250893", "1.29930997279734", "1.30032715605093", "1.3004785730821",
  "1.30154262450563", "1.302461", "1.30386684425114", "1.30438002120698",
  "1.30461834682389", "1.3047647219741", "1.30585304722559", "1.3067937735779",
  "1.30712803633755", "1.3074963710946", "1.30751338586806", "1.30751703730041",
  "1.30803621256234", "1.30822971200422", "1.30845544825732", "1.30867772794032",
  "1.30913166702397", "1.30955979607535", "1.30965150589688", "1.31088501240237",
  "1.31293014528666", "1.31342707975776", "1.31398835332345", "1.31664972197451",
  "1.31848306586196", "1.3214133317439", "1.32453874317344"
), `Longitude (from)` = c(
  "103.81722480263163",
  "103.81547665017668", "103.81783962251122", "103.83405671725487",
  "103.821011", "103.8285292287095", "103.83238179897589", "103.82668969231534",
  "103.83496162445665", "103.82259298997768", "103.82346004890803",
  "103.83440916705554", "103.832759", "103.85139096636622", "103.83205533028763",
  "103.85795174896221", "103.84958029974611", "103.83053183555204",
  "103.84780636909545", "103.8452569595532", "103.84093746088925",
  "103.83877618459663", "103.83623804216019", "103.86336013257065",
  "103.829875", "103.83239784275958", "103.907533", "103.9123223933556",
  "103.91493558885941", "103.90534997934479", "103.9110051545323",
  "103.91698861102066", "103.875264139574", "103.87989373246151",
  "103.91764721757994", "103.88490711001795", "103.92111718654822",
  "103.88850877408412", "103.90304313394574", "103.92471047692146",
  "103.8906311270188", "103.89936888898059", "103.8966101212743",
  "103.92481225868325", "103.9250247698478", "103.92790605020116",
  "103.93171138898548", "103.93334015990408", "103.93158674239623",
  "103.92782177344944", "103.92903818515839", "103.81722480263163",
  "103.81472833301791", "103.81765723225827", "103.82059301467888",
  "103.82748123930962", "103.83283384311112", "103.82204990181914",
  "103.83360028266564", "103.82395833301354", "103.83349881780524",
  "103.83222750001508", "103.8308377640795", "103.85402155505173",
  "103.857666", "103.85147164487202", "103.82997986347917", "103.84936128375956",
  "103.84529021429745", "103.8624541086332", "103.84184700607595",
  "103.83852481842337", "103.8297819", "103.83413070051408", "103.91266110940761",
  "103.90783296450577", "103.90592361097", "103.91059595623031",
  "103.91498055803811", "103.87548108759093", "103.8798058337351",
  "103.91754269765207", "103.88500750064323", "103.90349800941955",
  "103.92151900444857", "103.88847214403829", "103.92426998119757",
  "103.89180000002517", "103.90034889101835", "103.8965764453886",
  "103.92498850824487", "103.92634861688488", "103.92903327944508",
  "103.93157431388184", "103.93304055596909", "103.93156320282378",
  "103.92757312069912", "103.92903818515839", "103.81722480263163",
  "103.81547665017668", "103.81783962251122", "103.83405671725487",
  "103.821011", "103.8285292287095", "103.83238179897589", "103.82668969231534",
  "103.83496162445665", "103.82259298997768", "103.82346004890803",
  "103.83440916705554", "103.832759", "103.85139096636622", "103.83205533028763",
  "103.85795174896221", "103.84958029974611", "103.83053183555204",
  "103.84780636909545", "103.8452569595532", "103.84093746088925",
  "103.83877618459663", "103.83623804216019", "103.86336013257065",
  "103.829875", "103.83239784275958", "103.907533", "103.9123223933556",
  "103.91493558885941", "103.90534997934479", "103.9110051545323",
  "103.91698861102066", "103.875264139574", "103.87989373246151",
  "103.91764721757994", "103.88490711001795", "103.92111718654822",
  "103.88850877408412", "103.90304313394574", "103.92471047692146",
  "103.8906311270188", "103.89936888898059", "103.8966101212743",
  "103.92481225868325", "103.9250247698478", "103.92790605020116",
  "103.93171138898548", "103.93334015990408", "103.93158674239623",
  "103.92782177344944", "103.92903818515839", "103.81722480263163",
  "103.81472833301791", "103.81765723225827", "103.82059301467888",
  "103.82748123930962", "103.83283384311112", "103.82204990181914",
  "103.83360028266564", "103.82395833301354", "103.83349881780524",
  "103.83222750001508", "103.8308377640795", "103.85402155505173",
  "103.857666", "103.85147164487202", "103.82997986347917", "103.84936128375956",
  "103.84529021429745", "103.8624541086332", "103.84184700607595",
  "103.83852481842337", "103.8297819", "103.83413070051408", "103.91266110940761",
  "103.90783296450577", "103.90592361097", "103.91059595623031",
  "103.91498055803811", "103.87548108759093", "103.8798058337351",
  "103.91754269765207", "103.88500750064323", "103.90349800941955",
  "103.92151900444857", "103.88847214403829", "103.92426998119757",
  "103.89180000002517", "103.90034889101835", "103.8965764453886",
  "103.92498850824487", "103.92634861688488", "103.92903327944508",
  "103.93157431388184", "103.93304055596909", "103.93156320282378",
  "103.92757312069912", "103.92903818515839"
), `Latitude (to)` = c(
  "-",
  "1.28210155945393", "1.28329993019059", "1.28583847140468", "1.28394108576437",
  "1.28593135445772", "1.28572048365401", "1.28736808047078", "1.28475980959972",
  "1.284977", "1.28723833324362", "1.28623157720487", "1.29078162052352",
  "1.29618544092334", "1.293615", "1.29395444170081", "1.29811014243867",
  "1.2950426189642", "1.29831153783592", "1.29986928715834", "1.30027569326586",
  "1.30044251755834", "1.30252834773643", "1.295962316986", "1.29796011528522",
  "1.302127", "1.30528972611328", "1.30566306799291", "1.30425500081318",
  "1.30837865741776", "1.304086", "1.30496423786628", "1.30070547633658",
  "1.30674381370885", "1.30595638898755", "1.30711835522323", "1.3071917122941",
  "1.30726086825664", "1.30938972202558", "1.30787614366531", "1.30821308595952",
  "1.30943460005849", "1.30862937328019", "1.30851455788092", "1.31135799079971",
  "1.31250502315071", "1.31295810131062", "1.31390444400831", "1.31656999665769",
  "1.31875790465263", "1.32132832560695", "1.28362333298689", "1.28420923932422",
  "1.28484639603431", "1.28675501760897", "1.28606797463712", "1.28685859481289",
  "1.28722333302937", "1.28837086415387", "1.28599961406266", "1.29152472200833",
  "1.29409221679274", "1.29763682834545", "1.296265", "1.30032715605093",
  "1.29452091230981", "1.302461", "1.29647916306741", "1.29821382250893",
  "1.30712803633755", "1.29930997279734", "1.3004785730821", "1.30386684425114",
  "1.30154262450563", "1.3067937735779", "1.30585304722559", "1.30461834682389",
  "1.30438002120698", "1.30751338586806", "1.3074963710946", "1.30751703730041",
  "1.30822971200422", "1.30845544825732", "1.3047647219741", "1.30867772794032",
  "1.30913166702397", "1.31088501240237", "1.30965150589688", "1.30803621256234",
  "1.30955979607535", "1.31293014528666", "1.31342707975776", "1.31398835332345",
  "1.31664972197451", "1.31848306586196", "1.3214133317439", "1.32453874317344",
  "-", "-", "1.28210155945393", "1.28329993019059", "1.28583847140468",
  "1.28394108576437", "1.28593135445772", "1.28572048365401", "1.28736808047078",
  "1.28475980959972", "1.284977", "1.28723833324362", "1.28623157720487",
  "1.29078162052352", "1.29618544092334", "1.293615", "1.29395444170081",
  "1.29811014243867", "1.2950426189642", "1.29831153783592", "1.29986928715834",
  "1.30027569326586", "1.30044251755834", "1.30252834773643", "1.295962316986",
  "1.29796011528522", "1.302127", "1.30528972611328", "1.30566306799291",
  "1.30425500081318", "1.30837865741776", "1.304086", "1.30496423786628",
  "1.30070547633658", "1.30674381370885", "1.30595638898755", "1.30711835522323",
  "1.3071917122941", "1.30726086825664", "1.30938972202558", "1.30787614366531",
  "1.30821308595952", "1.30943460005849", "1.30862937328019", "1.30851455788092",
  "1.31135799079971", "1.31250502315071", "1.31295810131062", "1.31390444400831",
  "1.31656999665769", "1.31875790465263", "1.32132832560695", "1.28362333298689",
  "1.28420923932422", "1.28484639603431", "1.28675501760897", "1.28606797463712",
  "1.28685859481289", "1.28722333302937", "1.28837086415387", "1.28599961406266",
  "1.29152472200833", "1.29409221679274", "1.29763682834545", "1.296265",
  "1.30032715605093", "1.29452091230981", "1.302461", "1.29647916306741",
  "1.29821382250893", "1.30712803633755", "1.29930997279734", "1.3004785730821",
  "1.30386684425114", "1.30154262450563", "1.3067937735779", "1.30585304722559",
  "1.30461834682389", "1.30438002120698", "1.30751338586806", "1.3074963710946",
  "1.30751703730041", "1.30822971200422", "1.30845544825732", "1.3047647219741",
  "1.30867772794032", "1.30913166702397", "1.31088501240237", "1.30965150589688",
  "1.30803621256234", "1.30955979607535", "1.31293014528666", "1.31342707975776",
  "1.31398835332345", "1.31664972197451", "1.31848306586196", "1.3214133317439",
  "1.32453874317344", "-"
), `Longitude (to)` = c(
  "-", "103.81722480263163",
  "103.81547665017668", "103.83238179897589", "103.81783962251122",
  "103.82668969231534", "103.8285292287095", "103.82346004890803",
  "103.83405671725487", "103.821011", "103.82259298997768", "103.83496162445665",
  "103.83440916705554", "103.84958029974611", "103.832759", "103.85139096636622",
  "103.84780636909545", "103.83205533028763", "103.8452569595532",
  "103.84093746088925", "103.83877618459663", "103.83623804216019",
  "103.83239784275958", "103.85795174896221", "103.83053183555204",
  "103.829875", "103.90534997934479", "103.9110051545323", "103.9123223933556",
  "103.90304313394574", "103.907533", "103.91493558885941", "103.86336013257065",
  "103.875264139574", "103.91698861102066", "103.87989373246151",
  "103.91764721757994", "103.88490711001795", "103.89936888898059",
  "103.92111718654822", "103.88850877408412", "103.8966101212743",
  "103.8906311270188", "103.92471047692146", "103.92481225868325",
  "103.9250247698478", "103.92790605020116", "103.93171138898548",
  "103.93334015990408", "103.93158674239623", "103.92782177344944",
  "103.81472833301791", "103.81765723225827", "103.82059301467888",
  "103.82204990181914", "103.83283384311112", "103.83360028266564",
  "103.82395833301354", "103.83349881780524", "103.82748123930962",
  "103.83222750001508", "103.8308377640795", "103.82997986347917",
  "103.857666", "103.8624541086332", "103.85402155505173", "103.8297819",
  "103.85147164487202", "103.84936128375956", "103.87548108759093",
  "103.84529021429745", "103.84184700607595", "103.83413070051408",
  "103.83852481842337", "103.91498055803811", "103.91059595623031",
  "103.90783296450577", "103.91266110940761", "103.91754269765207",
  "103.8798058337351", "103.88500750064323", "103.92151900444857",
  "103.88847214403829", "103.90592361097", "103.92426998119757",
  "103.89180000002517", "103.92498850824487", "103.8965764453886",
  "103.90349800941955", "103.90034889101835", "103.92634861688488",
  "103.92903327944508", "103.93157431388184", "103.93304055596909",
  "103.93156320282378", "103.92757312069912", "103.92903818515839",
  "-", "-", "103.81722480263163", "103.81547665017668", "103.83238179897589",
  "103.81783962251122", "103.82668969231534", "103.8285292287095",
  "103.82346004890803", "103.83405671725487", "103.821011", "103.82259298997768",
  "103.83496162445665", "103.83440916705554", "103.84958029974611",
  "103.832759", "103.85139096636622", "103.84780636909545", "103.83205533028763",
  "103.8452569595532", "103.84093746088925", "103.83877618459663",
  "103.83623804216019", "103.83239784275958", "103.85795174896221",
  "103.83053183555204", "103.829875", "103.90534997934479", "103.9110051545323",
  "103.9123223933556", "103.90304313394574", "103.907533", "103.91493558885941",
  "103.86336013257065", "103.875264139574", "103.91698861102066",
  "103.87989373246151", "103.91764721757994", "103.88490711001795",
  "103.89936888898059", "103.92111718654822", "103.88850877408412",
  "103.8966101212743", "103.8906311270188", "103.92471047692146",
  "103.92481225868325", "103.9250247698478", "103.92790605020116",
  "103.93171138898548", "103.93334015990408", "103.93158674239623",
  "103.92782177344944", "103.81472833301791", "103.81765723225827",
  "103.82059301467888", "103.82204990181914", "103.83283384311112",
  "103.83360028266564", "103.82395833301354", "103.83349881780524",
  "103.82748123930962", "103.83222750001508", "103.8308377640795",
  "103.82997986347917", "103.857666", "103.8624541086332", "103.85402155505173",
  "103.8297819", "103.85147164487202", "103.84936128375956", "103.87548108759093",
  "103.84529021429745", "103.84184700607595", "103.83413070051408",
  "103.83852481842337", "103.91498055803811", "103.91059595623031",
  "103.90783296450577", "103.91266110940761", "103.91754269765207",
  "103.8798058337351", "103.88500750064323", "103.92151900444857",
  "103.88847214403829", "103.90592361097", "103.92426998119757",
  "103.89180000002517", "103.92498850824487", "103.8965764453886",
  "103.90349800941955", "103.90034889101835", "103.92634861688488",
  "103.92903327944508", "103.93157431388184", "103.93304055596909",
  "103.93156320282378", "103.92757312069912", "103.92903818515839",
  "-"
), sequence = c(
  1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
  12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L,
  25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L,
  38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L,
  51L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
  14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L,
  27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L,
  40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 1L, 2L, 3L, 4L, 5L, 6L,
  7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L,
  20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L,
  33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L,
  46L, 47L, 48L, 49L, 50L, 51L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
  9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L,
  22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L,
  35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L
)), row.names = c(NA, -196L), class = c("tbl_df", "tbl", "data.frame"))

创建于2023年2月27日,使用reprex v2.0.2

相关问题