When viewed, any .csv file committed to a GitHub repository automatically renders as an interactive table, complete with headers and row numbering. By default, the first row is your header row. The tables were supposed to look nice as below:
However, there's an error happening in my tabular data, and despite indicating the error, I can't fix it:
I'm using a csv file with a semicolon separator. Would anyone have an idea of what's happening?
Many thanks.
According to the docs, Github can only do its lay-out thing with .csv (comma-separated) and .tsv (tab-separated) files.
Using a semicolon as a separator isn't supported, at least not officially, and a spurious comma in a semicolon-separated file could well throw the algorithm off.
You could try replacing all semicolons with tabs and see how you fare.
If that doesn't work, try using commas as separators and enclose all text table cell data with quotes, like:
"Liver fibrosis, sclerosis, and cirrhosis","c370800","102922","Cystic fibrosis related cirrhosis","Diagnosis of liver fibrosis, sclerosis, and cirrhosis"
Note: no spaces after the commas. Also, if you have quotes in the text fields, you will have to escape those to "" (two quotes), or the algorithm will get confused.
You may get away with using quotes only for the offending text data, but that could well be more difficult to generate than just putting the quotes around all fields.
Thanks for your answer! That makes sense, when I use tabs as a separator, it doesn't work. However, when I use a comma as separator, it does work. But I can't use the comma as the separator, as I have text variables that contain comma on it. I've seen other interactive tables with a comma in the text variables, I just wanted to figure it out how they managed that.
Tabs don't work? Hrmph. They should. Could you point me to one of those tables with commas in the text variables that does work properly? I'll have a look at how they do it. Also, see edited answer. Don't forget to vote and/or accept the answer if you find it, um, acceptable.
I found the problem! I was using the function write.table and the arg sep = "," to export the .csv file in R. But when I used the function write_csv from the reader package, it did work! Apparently, the write.table was breaking down the rows where the comma appeared in a text. Many thanks for your insights, ocrdu.