MAHDLab / rIP

Detecting Fraud in Online Surveys by Tracing, Scoring, and Visualizing IP Addresses
MIT License
26 stars 4 forks source link

rIP Package Error #2

Closed chriscastille6 closed 5 years ago

chriscastille6 commented 5 years ago

I’m attempting to use the rIP package that you coauthored along with Ryan Kennedy and Scott Clifford. There is an error that I’ve been trying to troubleshoot now for the past two hours.

Specifically, when I apply the getIPinfo() function to my object, which is a data frame consisting of only the IP addresses (in character format), I receive the following error:

Error in curl::curl_fetch_memory(url, handle = handle) : Illegal characters found in URL

I’m assuming that this is related to the fact that the IP addresses (one example is “69.255.106.46”) are in character format. Unfortunately, I cannot find a solution to this problem easily. Do you have any advice for troubleshooting?

If it helps, my original dataset is a .sav file.

Thanks in advance!

pdwaggoner commented 5 years ago

Hi Chris - thanks for using the package and sorry you encountered an error! We have had a similar one in the past, though yours is a bit different. Note, though, that we are currently adding some expanded functionality to deal with this and similar problems internally in the package. These changes are in the dev version here in the repo, but we are still working out a few kinks before pushing a new release to CRAN. Stay tuned and always feel free to load the dev version directly from GitHub to access the latest developments (i.e., install_github("MAHDLab/rIP")).

For your issue, though, as you are using data from SPSS (.sav), you need to transform it to be readable as an R data.frame object, where traditional columns are readable. Then, you can call the IP address column with the function syntax. Try the following:

library(foreign) # to read .sav files
library(rIP)

x <- read.spss(".../your_file.sav") # load your data
x <- as.data.frame(x) # transform from SPSS format to a data.frame object
getIPinfo(x, "IPAddress", "YOUR API KEY HERE") # run the function

Good luck and let us know if you need anything else!