18
$\begingroup$

My question is simply:

What is the preferred way for CV users to share data?

If there isn't one, I think there should be.

For example, some users provide a link to an external data source. Others dump it in code mode. Each has its pros and cons, but at least they are open ways of sharing the data.

Seeing "[...] send me the data through email" a couple of times on CV was the motivation for this question. I hope we – as a community – agree that such behavior should be discouraged.


See also:

| |
$\endgroup$
  • 9
    $\begingroup$ I would say code mode is best. Links to other sites may rot away, eg. Our mandate is to develop a permanent repository of high-quality statistical (ML, etc) information in the form of Qs & As. Only having the dataset in the body of the Q really guarantees that. $\endgroup$ – gung - Reinstate Monica May 18 '18 at 19:06
  • 4
    $\begingroup$ The possibility of sharing data through SE was discussed--and answered in the negative by an SE representative--at stats.meta.stackexchange.com/questions/1035/…. $\endgroup$ – whuber May 18 '18 at 20:58
  • 3
    $\begingroup$ @whuber Although answered in the negative in the link your provided, I wonder how difficult it would be to create a plug-in that encodes/decodes something .csv files in jpg, gif, or png format? Given the volatile half life of "in the cloud" services, I can see the value in (reasonably sized) data hosting (although... I guess imgur is currently hosting, aren't they?). The issue is having the longevity of Qs & As not depend on the longevity of others' services. $\endgroup$ – Alexis May 18 '18 at 22:24
  • 8
    $\begingroup$ I don't think that well-established services like gist.github.com are in danger of rotting away before CrossValidated does. $\endgroup$ – amoeba May 19 '18 at 7:58
  • 3
    $\begingroup$ Alright, thank you for the feedback. Then should this not be written down somewhere... like in the help center: "If you want to share your data, CV prefers you post it in the body of your question (in code mode). If you feel you must use an alternative, we recommend gist.github.com. We do not endorse sharing data through email." Or something along those lines. $\endgroup$ – Jim May 19 '18 at 16:00
  • 1
    $\begingroup$ Surely the point of repositories such as figshare or dryad is that they won't rot away. Would these be a suitable? I'd argue that this is site is an academic repository of knowledge and as these are academic data sharing sites then they would be a good match. $\endgroup$ – drstevok May 20 '18 at 12:06
  • 1
    $\begingroup$ One thing I would recommend, particularly if you are using R, is using dput(). $\endgroup$ – Clarinetist May 22 '18 at 13:10
  • $\begingroup$ @Clarinetist may I ask you to you expand your comment as an answer. In the same way @AdamO has done. Could you go into the pros of using dput(). $\endgroup$ – Jim Jun 8 '18 at 16:14
  • $\begingroup$ @Jim IMO at least, it's honestly simple enough that I don't think an answer would provide any further substantial information. For example, if you have a table in R, doing dput() on the table provides you the raw code used for generating the table, which you can share with anyone else. $\endgroup$ – Clarinetist Jun 8 '18 at 18:49
4
$\begingroup$

I'm contributing this as an answer because it's rather hard to share an example in the comments field:

Data of 20 rows or fewer seem fine to share inline. One nice way to share R data (similar to datalines in SAS) is using textConnection. This blends the ease of copy-paste executable code and readable data formats. It also doesn't require any external links (many of which are blocked on more restricted computer networks like mine).

As an example:

mydf <- read.table(textConnection("
 Sepal.Length Sepal.Width Petal.Length Petal.Width Species
          5.1         3.5          1.4         0.2  setosa
          4.9         3.0          1.4         0.2  setosa
          4.7         3.2          1.3         0.2  setosa
          4.6         3.1          1.5         0.2  setosa
          5.0         3.6          1.4         0.2  setosa
          5.4         3.9          1.7         0.4  setosa
"), header=T)
| |
$\endgroup$
  • 2
    $\begingroup$ In the same spirit I note that Stata has dataex (bundled with the company's software in Stata 14.2 or 15.1 up, and otherwise downloadable with ssc install dataex). More generally, data examples as text with one header line are highly readable across different software. $\endgroup$ – Nick Cox May 29 '18 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .