I am rendering a table report via googleVis version 0.5.10. My data contains date columns. When I render table report I get date columns formatted with the full month names in them. By default they are using default language, which is Russian for me.
How do I set language in googleVis to English, so it could be passed to google?
Thank you.
Maybe a little late for an answer, but I've only recently seen your post while googling for the same issue with an app I developed, where dates where expressed in italian (eg. 24 June 2017 was shown as 24 Giu 2017).
In my case I was rendering a gvisLineChart and setting the gvis.language parameter (options=list(gvis.language="en", ) didn't work.
I was able to make it work by specifying the date format in the statement used to build the dataframe I need.
chart3 <- aggregate(geoData[,c("slug")], by=list(format(as.Date(geoData$timestamp),"%d %b %Y")), FUN=length)
Since you haven't posted any code I'm not able to suggest more solutions to your problem, but I guess you should try to set format as well.
Related
I am working an uploaded document originally from google docs downloaded to an xlsx file. This data has been hand entered & formatted to be DD-MM-YY, however this data has uploaded inconsistently (see example below). I've tried a few different things (kicking myself for not saving the code) and it left me with just removing the incorrectly formatted dates.
Any suggestions for fixing this in excel or (preferably) in R? This is longitudinal data so it would be frustrating to have to go back into every excel sheet to update. Thanks!
data <- read_excel("DescriptiveStats.xlsx")
ex:
22/04/13
43168.0
43168.0
is a correct date value
22/04/13
is not a valid date. it is a text string. to convert it into date you will need to change it into 04/13/2022
there are a few options. one is to change the locale so the 22/04/13 would be valid. see more over here: locale differences in google sheets (documentation missing pages)
2nd option is to use regex to convert it. see examples:
https://stackoverflow.com/a/72410817/5632629
https://stackoverflow.com/a/73722854/5632629
however, it is very likely that 43168 is also not the correct date. if your date before import was 01/02/2022 then after import it could be: 44563 which is actually 02/01/2022 so be careful. you can check it with:
=TO_DATE(43168)
and date can be checked with:
=ISDATE("22/04/13")
I am importing an excel file that has a date field with the following format: dd/mm/YYYY
It imports the data OK, however it does something strange with the dates. If the day is higher than 12, then it takes the current date.
I found this on the log:
WARNING: unrecognized date format ``, assigning current date
For example: the date 08/04/2020 is imported ok because 08 <= 12, however the date 23/02/2020 is not imported because 23 is not <= 12, and then it takes the current date.
Any ideas about what is happening?
This issue can get confusing with Excel, since typically, if the system is set for U.S. locales, Excel converts standard European date format in day-month-year to some version of month/day/year. In other words, tThe forward slash usually indicates American format, which is month first, as in April 9, 2022 or 04/09/22. You can force day/month/year, and apparently that was done for your file or system, but that's not an expected or standard format.
Without examining All Import code in detail, I'd say the behavior you describe implies it is presuming the standard usage. I'd therefore recommend that you try converting your date column before attempting imports, but how to do that efficiently would probably be more an Excel question than a WordPress question, unless you are able in your version of All Import to perform a custom conversion on the field.
A trick that sometimes works on this type of problem is copy-pasting Excel data into a Google Sheet, then downloading as CSV, without ever opening the file in your system before re-uploading. Google Sheets is pretty good about such conversions in general, but no guarantees: Your source file might defeat it in this case.
I had the same issue. Change the dates in your csv file to mm/dd/yyyy and when it imports it will automatically convert to dd/mm/yyyy if that is what your WP website is set up to use.
Only numbers lower than 12 will work the way you are importing because there are only 12 months in a year and it is reading you dd as mm.
I've been trying to make a timeseries plot in Grafana, but I keep getting messages like "Data does not have a time field" or "No numeric fields found." How could I format my data to fix these issues? Thank you!
See README of used plugin first
https://grafana.com/grafana/plugins/frser-sqlite-datasource/ :
Your ts column is not formatted in accordance with RFC3339.
Your value_string is a string and not numeric - REAL type.
Reformat your time variable in SQLite to Unix time format, ie strftime("%s" , my_time_var ).
Then in the grafana query dialog define my_time_var as a time formatted column of a Time Series.
I don't know if it also works in Windows.
I have a file that I am reading in. Everything is fine, except for one detail. In the file, dates are stored in the format "mm/dd/yyyy". When I try to read this in with fread, I'm using
fread(..., select = c(var = "Date"))
It appears fread assumes it's in the ISO format, so January 9, 2019 stored as 1/9/2019 is read in as the date"0001-09-20", September 20, year 1. Is there any way to specify a format to tell fread how to read this? It could be in select or colClasses, though select is my preference as I've already selected around 80 columns and specified their data types.
I know I could read it in as character and change it afterward. I'm trying to do as much as possible while reading in the data. If I have to change it after the fact, I will do that.
You have two options.
Read as character and convert in extra step.
Fill feature request in data.table github repo providing your minimal example file and wait for it to be implemented.
Personally I would go with the first one. Good thing is that you can do both.
my data frame has a column A with strings in character form
> df$A
[1] "2-60", "2-61", "2-62", "2-63" etc
I saved the table using write.csv, but when I open it with Excel column A appears formatted as date:
Feb-60
Feb-61
Feb-62
Feb-63
etc
Anyone knows what can I do to avoid this?
I tweaked the arguments of write.csv but nothing worked, and I can't seem to find an example in Stack Overflow that helps solve this problem.
As said in the comments, this is an excel behaviour, not R's. And that can't be deactivated:
Microsoft Excel is preprogrammed to make it easier to enter dates. For
example, 12/2 changes to 2-Dec. This is very frustrating when you
enter something that you don't want changed to a date. Unfortunately
there is no way to turn this off. But there are ways to get around it.
Microsoft Office Article
The first suggested way around it according to the article is not helpful, because it relies on changing the cell formatting, but that's too late when you open the .csv file in excel (it's already converted to an integer representing the date).
There is, however, a useful tip:
If you only have a few numbers to enter, you can stop Excel from
changing them into dates by entering:
An apostrophe (‘) before you enter a number, such as ’11-53 or ‘1/47. The apostrophe isn’t displayed in the cell after you press
Enter.
So you can make the data display as original by using
vec <- c("2-60", "2-61", "2-62", "2-63")
vec <- paste0("'", vec)
Just remember the values will still have the apostrophe if you read them again in R, so you might have to use
vec <- sub("'", "", vec)
This might not be ideal but at least it works.
One alternative is enclosing the text in =" ", as an excel formula, but that has the same end result and uses more characters.
Another solution - a bit tedious, Use Import Text File in Excel, click thru the dialog boxes and in Step 3 of 3 of the Text Import Wizard, you will have an option of setting the column data format, use "Text" for the column that has "2-60", "2-61", "2-62", "2-63". If you use General (the default), Excel tries to be smart and converts the answer for you.
I solved the problem by saving the file using the .xlsx format by using the function
write.xlsx()
from the package xlsx (https://www.rdocumentation.org/packages/xlsx/versions/0.6.5)