I have a table
EmployeeSalary:
Date | Salary
01.12.2016 | 2000
01.02.2016 | 3000
03.02.2016 | 5000
01.03.2017 | 1000
30.01.2017 | 5000
10.03.2017 | 1300
When the System Date is 13.03.2017. How to get the present month dates and the past month Dates (i.e., from February 1 to System date).
My code is :
start= format(Sys.Date() - 30, '%Y-%m-01')
end=Sys.time()
while (start<end)
{
print(EmployeeSalary)
EmployeeSalary$"Date" = EmployeeSalary$"Date"+1
}
Error which I get:
Error: non-numeric argument to binary Operator
Expected Output is :
EmployeeSalary:
Date | Salary
01.02.2016 | 3000
03.02.2016 | 5000
01.03.2017 | 1000
10.03.2017 | 1300
seq()
function with dates, ie,seq(Sys.Date(), by='month', length=3)
outputs"2017-03-13" "2017-04-13" "2017-05-13"
. – Fernandoas.Date
. For example,as.Date("01.12.2016", "%m.%d.%Y")
will return a date for the first cell. – lmo