全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
3737 1
2013-12-12
悬赏 5 个论坛币 未解决
我有一个CSV文件,读入R后原来的日期变成了因子格式如“2013-10-15”,怎么把它转化为R认可的日期格式,谢谢了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-12-12 19:00:57
Use "strptime" function: suppose your variable is named "dt", the following cmd will give you the date in the format recognized by R:
复制代码
Optionally, you may want to read your data using "stringsAsFactors=FALSE" so that the date will be read as string and when using "strptime" function you can avoid the implicit covert the factor back to string.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群