Comments (16)
Strange thing however was that I got all fields in one column. Troubleshooting that now.
Could that be related to d7c0c3e ?
from limer.
I got the same error and then I looked at survey permissions - turned out that the user did not have survey permissions, once I added them I got data. Strange thing however was that I got all fields in one column. Troubleshooting that now.
from limer.
@Jan-E That is right - it was. It is because I had an older version (Version 2.67.1+170626) where the field separator was different. I solved this by installing a version pre-29th April. install_github("cloudyr/limer", ref = "f0e2acced9178133f56f09f40ba690d6787eda64")
- I will update the installation some time soon, but presently I just needed the exporting to work.
from limer.
@r0berts We had it the other way around. Limesurvey 3.12.1, but a limer that was too old. So we just had to update limer. I will see if I can patch it do do a version-specific base64_to_df.
from limer.
The PR seems to be already there: #42
from limer.
@Jan-E this is good, perhaps to have an option to supply version or other switch. If need be, I could do some work on documenting limer, so that it would be easier for newcomers to figure this out. I could do something like a manpage from a begginner's viewpoint, if you'd like - maybe to supplement the readme file?
from limer.
I am already experimenting to get the version number:
get_session_key()
lsversion<-call_limer(method="get_site_settings",params=list(sSetttingName="versionnumber"))
lsmajor<-substr(lsversion, 1, 1)
print(lsmajor)
In my case lsversion becomes "3.12.1" and lsmajor "3". With this it should be possible to restrict d7c0c3e to versions > 2.
from limer.
@r0berts Could you test
devtools::install_github("toolsforresearch/limer", username = NULL, ref = "ls_v2_export_responses")
3b1d2d1 handles LS v2 the old way and LS v3 with a sep = ";". I tested it for Limesurvey 3.12.1.
Can you confirm it works in LS v2? Then I will create e new Pull Request.
from limer.
@Jan-E It seems NOT to work. There are error messages:
Error in if (lsmajor < 3) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In base64_to_df(unlist(results)) : NAs introduced by coercion
And no data are received.
When I quit the session (restart rstudio) and run (knitr) the report it does not work at library loading stage:
Quitting from lines 13-50 (surveyProc.rmd)
Error in if (lsmajor < 3) { : missing value where TRUE/FALSE needed
Calls: <Anonymous> ... withVisible -> eval -> eval -> get_responses -> base64_to_df
In addition: Warning message:
In block_exec(params) : failed to tidy R code in chunk <setup>
reason: Error in loadNamespace(name) : there is no package called 'formatR'
But when I load libraries manually I do not seem to get that error on loading, but later no data received with the first error.
from limer.
Looks like lsmajor is not set. Could you run this in a R prompt, after entering your lime_api options:
library(limer)
get_session_key()
lsversion<-call_limer(method="get_site_settings",params=list(sSetttingName="versionnumber"))
print(lsversion)
lsmajor<-as.numeric(substr(lsversion, 1, 1))
print(lsmajor)
from limer.
@Jan-E Yes, lsmajor is returned as list with this content:
> str(lsversion)
List of 1
$ status: chr "Invalid setting"
Maybe it is due to this - from API reference:
Get a global setting
get_site_settings(string $sSessionKey, string $sSetttingName) : string|array
Function to query site settings. Can only be used by super administrators.
As I connect from a plain user account. - Yess that is it. If I substitute my superuser account the version string reported correctly. I am not sure RPC use plaintext or ssl in connecting to limesurvey, but I really liked to use a non-privileged account. I am giving report capability to plain users and I would not want to give s-admin password to them. Maybe a simple solution is to add an extra option like:
options(lime_api = limeAPI)
options(lime_username = "user1")
options(lime_version = "2")
It could by default be set to 3 and it could also have the automatic checking running alongside - in case it is run from super-admin account.
from limer.
@r0berts
Ouch. We also had a script with LS 2 and a non-superadmin RPC2 user. Hence, it failed. I now tried another method: test if 'copy_survey' exists. copy_survey was introduced in LS 3.0.
toolsforresearch@d92be6f?diff=unified contains the final function:
base64_to_df <- function(x) {
raw_csv <- rawToChar(base64enc::base64decode(x))
have_copy_survey <- call_limer(method="copy_survey")
# returns NULL in LS2
# returns array(status => "Copy failed", error => "No survey ID has been provided. Cannot copy survey") in LS3
if (is.null(have_copy_survey)) {
return(read.csv(textConnection(raw_csv), stringsAsFactors = FALSE))
} else {
return(read.csv(textConnection(raw_csv), stringsAsFactors = FALSE, sep = ";"))
}
}
I confirmed that this works in LS Version 2.6.4-lts with a non-superadmin account. Could you once again test the patch?
devtools::install_github("toolsforresearch/limer", username = NULL, ref = "ls_v2_export_responses_version_2")
Thanks.
from limer.
get_session_key()
lsversion<-call_limer(method="get_site_settings",params=list(sSetttingName="versionnumber"))
lsmajor<-substr(lsversion, 1, 1)
print(lsmajor)
Isn't there one "t" too many in SettingName? ;-)
from limer.
Yes, but they are quite convinced, that you spell it that way
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/remotecontrol/remotecontrol_handle.php#L95
from limer.
Hi Jan, sorry I was away. I tested today. Your version works fine on my 2.67 - it gets data perfectly alright with non admin account. Then I tested it on the latest version of LS (Version 3.14.1+180731) running on my laptop - it fails with this error:
> initData <- get_responses(limeSurveyNumber)
Error: lexical error: invalid char in json text.
<!DOCTYPE html> <html lang="en"
(right here) ------
I also tested the latest limesurvey version with the version from standard repo https://github.com/cloudyr/limer and that works fine on the latest.
from limer.
@Jan-E Would it be an idea to have two versions of this piece of software: limer and limer3, to avoid this confusion.
And to persuade the LS developers to make it possible to ask the API for a version number?
Using LS3.14 I ran into this problem again.
from limer.
Related Issues (20)
- fix for encoding in base64_to_df
- Not getting First name and Last name data responce on export responces api call
- not getting full heading in response
- R textConnection HOT 1
- SQL SELECT query limesurvey using limer? HOT 2
- expose separator value in base64_to_df()
- Using insecure server connections
- get_session_key() returns Error: Argument 'txt' must be a JSON string, URL or file. HOT 3
- get_responses() returns multiple observations but only one variable HOT 3
- Log in not working HOT 4
- Consider putting this package on LimeStore!
- getResponses() for one question HOT 3
- Does limer work with limesurvey 5.3? HOT 3
- example using set_survey_properties HOT 1
- update_response HOT 1
- Error get_session_key() HOT 17
- Fetching all available data (including incomplete) HOT 2
- stop double parsing json HOT 1
- Limer dont work in R?
- Example code throws "Error: lexical error: invalid char in json text."
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from limer.