skardhamar / rga

R Google Analytics
186 stars 88 forks source link

Error in charToDate(x) : character string is not in a standard unambiguous format #95

Open Akshay-Kalwar opened 6 years ago

Akshay-Kalwar commented 6 years ago

I am trying to automate the date conversion of different columns in a table here is what my table looks like DAsset1 PAsset1 DAsset2 PAsset2 DAsset3 PAsset3 1 38721 95.53 38812 1734.55 38812 1123.60 2 38722 93.55 38814 1705.95 38814 1093.50 3 38723 94.33 38817 1695.60 38817 1202.85 4 38726 94.70 38819 1699.75 38819 1197.65 5 38727 94.78 38820 1701.85 38820 1193.50 6 38729 90.55 38824 1624.50 38824 1217.55

So i want to change date format for DAsset1,DAsset2,DAsset3 in the following way

for(i in 1:n) { if(i %% 2!=0) { Data[i]=as.Date(paste0("Data$DAsset",i),origin="1899-12-29",format=) Data[i] next } }

But i am getting this error Error in as.Date.default(Data[f]) : do not know how to convert 'Data[f]' to class “Date”

jdeboer commented 6 years ago

This issue appears to be off topic and may be more suitable on Stackoverflow.