最近在学习R语言,开个日志记录学习中遇到的问题以及解决方案。
目前基本一切顺利,以下是问题列表:
- Sys.setlocale("LC_TIME", "C");
- ##在使用日期之前最好先进行默认值的设值,“为了保证的代码的可重复性 这种设置的语句还是习惯性的添加比较合适”(来源:http://bbs.pinggu.org/thread-2657478-2-1.html)
- 问题描述:遇到这个问题是在使用strptime()函数对日期字符串进行转换的时候,return 了 NA。百度之后了解到,系统本身的环境变量"LC_TIME"是“zh_CN.UTF-8”,是中文,而我因为在上国外的公开课,给的样本日期字符串,日期全名是英文,所以出现了在中文环境下不识别的问题。调用strptime()函数前运行了上述语句,返回了正确值。
- ##附上英文说明,虽然这是讲C的,8过是通用滴~————Most running environments have certain locale information set according to the user preferences or localization. But, independently of this system locale, on start, all C programs have the "C" locale set, which is a rather neutral locale with minimal locale information that allows the result of programs to be predictable. In order to use the default locale set in the environment, this function can be called with "" as the locale parameter.
有没有会Python的,我想学呀
@xqiushi codecademy.com
去自学吧