cloudyr / Rmonkey

A Survey Monkey R Client
http://cloud.r-project.org/package=Rmonkey
53 stars 24 forks source link

RMonkey data frame #15

Closed rsmquest closed 8 years ago

rsmquest commented 8 years ago

I've downloaded data from SurveyMonkey using RMonkey into a data frame using the following code:

g <- getresponses(r, s[[1]])
g <- as.data.frame(g)
temp <- edit(g)

Using the data editor, I can see that the data obtained for each respondent is all in one column, as shown in this screengrab:

screenshot

I want to be able to have the question ##as the header of the column and return all related answer IDs for each respondent within that column.

Was told that this sounds like a bug and to report it here.

leeper commented 8 years ago

Taking another look at this, it would appear that the issue is actually an error in as.data.frame() (probably same issue as in https://github.com/cloudyr/Rmonkey/issues/14). So you're looking at your initial g object rather than a data.frame representation thereof. Can you confirm that you're seeing an error during the as.data.frame(g) step, @rsmquest?

rsmquest commented 8 years ago

class(g) confirms "data.frame", but get this error message when opening data editor:

Warning: class discarded from column ‘x’

rsmquest commented 8 years ago

Is there any way to manually separate these lists in the meantime? I've been trying all sorts of methods, but haven't had much success so far

leeper commented 8 years ago

@rsmquest The challenge is how the Survey Monkey API returns data values. It doesn't return raw data, but rather codes that correspond to data values stored in the "surveydetails" object. This means there's not really any useful way of looking at the value returned by getresponses() on its own.

The as.data.frame() method is actually quite convoluted. I have an idea for how to fix this, but it will unfortunately require some effort (and I won't be able to get to it until the end of this week).

leeper commented 8 years ago

Unfortunately, I do not have time to work on this, but invite contributions to get this working with the v3 API.