拆分单个变量数据帧

时间:2017-11-29 15:28:10

标签: r dataframe data-munging

我的CSV文件只显示一个变量。我想将它拆分为6.我需要帮助。

str(nyt_data)
'data.frame':   3104 obs. of  1 variable:
 $ Article_ID.Date.Title.Subject.Topic.Code: Factor w/ 3104 levels "16833;7-Dec-03;Ruse in Toyland: Chinese Workers' Hidden Woe;Chinese Workers Hide Woes for American Inspectors;5",..: 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 ...

nyt_data$Article_ID.Date.Title.Subject.Topic.Code

在上面的代码行之后取代的结果是:

> head(nyt_data$Article_ID.Date.Title.Subject.Topic.Code)
[1] 41246;1-Jan-96;Nation's Smaller Jails Struggle To Cope With Surge in Inmates;Jails overwhelmed with hardened criminals;12                                                                          
[2] 41257;2-Jan-96;FEDERAL IMPASSE SADDLING STATES WITH INDECISION;Federal budget impasse affect on states;20                                                                                          
[3] 41268;3-Jan-96;Long, Costly Prelude Does Little To Alter Plot of Presidential Race;Contenders for 1996 Presedential elections;20  

请帮助我使用代码将这些代码拆分为6个单独的列Article_IDDateTitleSubjectTopicCode

0 个答案:

没有答案