Grouped variable naming in central exports

1. What is the problem? Be very detailed.

When I use groups in a form, the group name is appended to variable names in the exported data.

Using Central I get a minus sign separator in the form group-var
Using ruODK the package recodes this to get a neat export with a period separator in the form group.var

I'd expect that this would cause problems for most other programming languages.
Is there a rationale for adding a mathematical operator into the variable names?

2. What app or server are you using and on what device and operating system? Include version numbers.

client (v1.2.0)
server (v1.2.0)

3. What you have you tried to fix the problem?

4. What steps can we take to reproduce the problem?
Use a group. Export using Central

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
None separates the group name with an underscore (names_sep}.
You'll get this through odata_submission_get. simply downloads the CSV exports and should not change column headers.

I am sleep deprived and my memory is fuzzy, so I might confuse things here. Where are you getting dots in column names from ruODK?


So I'm not using OData for this as it is a form level encrypted file. Essentially using ruODK to download and decrypt the file from central.

I now realise that the dots are coming from R as I used the old style read.csv (force of habit, old dogs!) which automatically sanitises dodgy names as it imports CSV.

Using tidyverse read_csv it preserves the group-var style of the central export file, unless I use tibble's as_tibble(df,.name_repair="universal") to sanitise. ruODK is not doing anything here

So this resolves the R weirdness but doesn't solve the initial problem, which is that maths operators (and whitespace) are probably pretty bad.

1 Like

Thanks for the clarification, yep that makes sense! I suspected you'd have encrypted forms.

A very useful package is janitor with its function clean_names, which gets rid of dashes in variables for you.