将数字月份转换为月份缩写 [英] Convert a numeric month to a month abbreviation

查看:109
本文介绍了将数字月份转换为月份缩写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个csv,其中的列名为month作为数字矢量。

I have a csv with a column called month as a numeric vector.

有什么方法可以将其转换为月份的缩写月份名称?

Is there any way to convert this to a abbreviated month name of the month?

推荐答案

看看 month.abb 常量。例如,假设您有一个由月份数组成的整数矢量,则可以通过执行以下操作使用它来获取月份名称的三个字母缩写:

Take a look at the month.abb constant. For example, assume you have a vector of integers consisting of the number of the month, then you can use it to get the three letters abbreviation of the month name by doing:

> month <- c(12,3,6,2,3,7)
> month.abb[month]
[1] "Dec" "Mar" "Jun" "Feb" "Mar" "Jul"

这篇关于将数字月份转换为月份缩写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆