Questions tagged [yearmonth]
61 questions
5
votes
1 answer
Sort year-month column by year AND month
I am trying to order a series of time data I have stored in a data frame. The format is of:
"%Y-%b"
Which looks like "2009-Sep"etc.
Until now I have managed to find this method:
ds[order(as.Date(ds$yearmonth, format = "%Y-%b")),]
But it only sort…

Kasper Christensen
- 895
- 3
- 10
- 30
3
votes
3 answers
Convert YearQtr series to End of the month Date
I am trying to convert a quarterly series of data in to monthly series in R. I can repeat the same quarterly data for each of the three months in the quarter. Not sure why as.yearmon gives out "Jul" irrespective of Q1,Q2,Q3 etc. Also any help on…

Jain
- 959
- 2
- 13
- 31
3
votes
1 answer
To Get YEARMONTH from date in Athena
I can get year and month separately in Athena but i don't know how to get YEARMONTH from date.
select year(date1) from table1
select Month(date1) from table1
Please suggest how to get YEARMONTH. Thank you in advance.

Dee
- 31
- 1
- 1
- 5
2
votes
1 answer
Ggplot with yearmonth in x-axis
I have a dataset with information on where individuals work over time, where time is defined as year/month (and shown as numeric values YYYYMM in my dataset). I run a ggplot to visualise how long individuals stay in a given workplace as well as how…

PaulaSpinola
- 531
- 2
- 10
2
votes
1 answer
Convert decimal month and year into Date
I have a 'decimal month' and a year variable:
df <- data.frame(decimal_month = c(4.75, 5, 5.25), year = c(2011, 2011, 2011))
How can I convert these variables to a Date? ("2011-04-22" "2011-05-01" "2011-05-08"). Or at least to day of the year.

Marcin Koprowski
- 35
- 3
1
vote
1 answer
ODBC Informix server: Error while Extracting Month name from the date
I am trying to get the Month name from the date so that I can use the month in the Tableau. Using the MONTH function, I am getting the Month number 1-12 which is coming as Measure Columns in the Tableau.
(https://i.stack.imgur.com/mbTQ9.png)
that's…

Z_N
- 13
- 4
1
vote
1 answer
Excel Formula to Display Month Numbers Within a Certain Period
I'm in need of some formula assistance in Excel. I'm trying to use the dates in columns G and H (period start date and period end date) to automatically fill out the matrix on the right (columns O through Z) as I have currently manually completed…

Colleen F
- 11
- 1
1
vote
4 answers
convert 'yyyy-mm-dd' to month-year format and make a sequence in r
I want to make a Date sequence from 2010-04-01 to 2040-03-01, and express the date format to be "April-2010", or "Apr 2010". However, when I used as.yearmon() it only returned "4 2010" instead of "Apr 2010".
This is my first code which I tried to…

Seoyoung Park
- 35
- 4
1
vote
1 answer
Sum a daily variable per month taking into account the year
I have the following dataframe, df:
structure(list(x = structure(1:961, levels = c("2019-11-30",
"2019-12-01", "2019-12-02", "2019-12-03", "2019-12-04", "2019-12-05",
"2019-12-06", "2019-12-07", "2019-12-08", "2019-12-09", "2019-12-10",…

Mark
- 1,577
- 16
- 43
1
vote
2 answers
Displaying labels on x-axis with "yearmon" variable (ggplot)
I am trying to display all month values on my x-axis, which is formatted as a "yearmon" variable
My data are structured as follows:
Print data example
dput(collective_action_monthly[1:4, ])
ouptut:
structure(list(collective_action = structure(c(2L,…

maldini1990
- 279
- 2
- 11
1
vote
2 answers
How to return Dates between in format year-months?
Is there a way to return dates between in format year-months in Cognos reports?
Example: I've been using the following to figure out "age"
_years_between (current_date, [DateOfBirth]).
Result comes out as just the age in years.
I'm looking for a…

Olendris63
- 97
- 6
1
vote
1 answer
How to display wide table with specific order (month year) even when data points are missing?
> df_1
# A tibble: 47 x 3
# Groups: therapy_class [9]
therapy_class Year_month count
1 ALK Inhibitors Dec 2019 16
2 ALK Inhibitors …

sutsabs
- 431
- 2
- 11
1
vote
3 answers
How to get previous month from current month in java?
I have following scenario.
String currentMonth = SEP/2021
Here I want String previous month = AUG/2021.
How can I achieve this in java?

Rohan
- 11
- 1
1
vote
3 answers
How to convert character column to date?
My data frame:
yearmonth basinflow
1 1966-01 0.000105
2 1966-02 0.0000946
3 1966-03 0.816
4 1966-04 5.17
5 1966-05 0.102
6 1966-06 0.0729
I want to add a column with just the month values, but…

Kayla
- 59
- 5
1
vote
3 answers
Finding consecutive months in a list
I'm interested in finding the largest set in an unordered list of months, that can be returned as an ordered list of distinct, consecutive months.
For example:
consecutive_months(["December", "January", "February", "April"])
Would…

Carl Cervone
- 1,103
- 8
- 10