% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plausi_checks.R
\name{ip_check}
\alias{ip_check}
\title{Check for duplicate IP addresses}
\usage{
ip_check(dataframe)
}
\arguments{
\item{dataframe}{A data frame containing the study data. Must include a
variable named \code{ip} representing participants' IP addresses.}
}
\value{
A data frame with an additional column \code{check_ip}, indicating
whether each case has a unique IP (\code{"ok"}) or is a potential duplicate
(\code{"possible duplicate"}).
}
\description{
\code{ip_check()} identifies potential duplicate participations in a dataset
by checking for repeated IP addresses. Cases with duplicated IPs are
flagged as \code{"possible duplicate"}, while unique IPs are labeled \code{"ok"}.
Keep in mind that in some cases, duplicate IP addresses should not lead to exclusion,
for example when different participants (such as siblings or flatmates) plausibly
use the same device.
}
\details{
If WEXTOR-style prefixes (i.e. \code{.wx.}) are detected in the variable names,
they are removed prior to performing the check.

The function uses \code{duplicated()} to flag repeated IP addresses.
Only subsequent occurrences are marked as duplicates; the first instance
of each IP is treated as valid.
}
\examples{
data <- read_WEXTOR(path_to_file("BiFiX_data_raw.csv"))
# The example data does not contain real IPs (data protection), so we will use simulate ones
data$ip <- sample(1:1000, nrow(data), replace = TRUE)

new_data <- ip_check(data)

}
