-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8224112
commit 56bafd8
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Package: rIP | ||
Type: Package | ||
Title: Passes an array of IP addresses to iphub.info and returns a dataframe with details of IP | ||
Version: 0.1.0 | ||
Author: Ryan Kennedy | ||
Maintainer: Ryan Kennedy <[email protected]> | ||
Description: Takes as its input an array of IPs and the user's X-Key, passes these to iphub.info, and returns a dataframe with the ip (used for merging), country code, country name, asn, isp, block, and hostname. | ||
Especially important in this is the variable "block", which gives a score indicating whether the IP address is likely from a server farm and should be excluded from the data. It is codes 0 if the IP is residential/unclassified (i.e. safe IP), 1 if the IP is non-residential IP (hostping provider, proxy, etc. -- should likely be excluded), and 2 for non-residential and residential IPs (more stringent, may flag innocent respondents). | ||
The recommendation from iphub.info is to block or exclude those who score block = 1. | ||
Imports: | ||
httr | ||
License: CC0 | ||
Encoding: UTF-8 | ||
LazyData: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exportPattern("^[[:alpha:]]+") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#' @export | ||
|
||
# rIP function | ||
|
||
getIPinfo <- function(ips, key) { | ||
options(stringsAsFactors = FALSE) | ||
url <- "http://v2.api.iphub.info/ip/" | ||
pb <- txtProgressBar(min = 0, max = length(ips), style = 3) | ||
ipDF <- c() | ||
for (i in 1:length(ips)) { | ||
ipInfo <- httr::GET(paste0(url, ips[i]), add_headers(`X-Key` = key)) | ||
infoVector <- unlist(httr::content(ipInfo)) | ||
ipDF <- rbind(ipDF, infoVector) | ||
setTxtProgressBar(pb, i) | ||
} | ||
close(pb) | ||
ipDF <- data.frame(ipDF) | ||
rownames(ipDF) <- NULL | ||
return(ipDF) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# rIP | ||
This is an R code project for detecting likely responsese from server farms on MTurk surveys. It will eventually be built into a package, but for now is an easy function for use. Credit to @tylerburleigh for pointing out the utility of iphub.info. His method for incorporating this information into Qualtrics surveys can be found here: https://twitter.com/tylerburleigh/status/1042528912511848448?s=19. | ||
This is an R code project for detecting likely responsese from server farms on MTurk surveys. | ||
|
||
Takes as its input an array of IPs and the user's X-Key, passes these to iphub.info, and returns a dataframe with the ip (used for merging), country code, country name, asn, isp, block, and hostname. | ||
|
||
Especially important in this is the variable "block", which gives a score indicating whether the IP address is likely from a server farm and should be excluded from the data. It is codes 0 if the IP is residential/unclassified (i.e. safe IP), 1 if the IP is non-residential IP (hostping provider, proxy, etc. -- should likely be excluded), and 2 for non-residential and residential IPs (more stringent, may flag innocent respondents). | ||
|
||
The recommendation from iphub.info is to block or exclude those who score block = 1. | ||
|
||
Credit to @tylerburleigh for pointing out the utility of iphub.info. His method for incorporating this information into Qualtrics surveys can be found here: https://twitter.com/tylerburleigh/status/1042528912511848448?s=19. |