Use missing instead of is.na to deal with not given parameters

Change-Id: Id7a6153ca3f98cc6e530ca07af8c7a7317251c6a
diff --git a/R/KorAPConnection.R b/R/KorAPConnection.R
index 4652927..5ecd11c 100644
--- a/R/KorAPConnection.R
+++ b/R/KorAPConnection.R
@@ -10,13 +10,13 @@
 #' @note Currently it is not possible to authenticate the client
 #'
 #' @export
-KorAPConnection <- function(KorAPUrl=defaultKorAPUrl, apiVersion='v1.0', apiUrl = NA) {
+KorAPConnection <- function(KorAPUrl=defaultKorAPUrl, apiVersion='v1.0', apiUrl) {
   m <-regexpr("https?://[^?]+", KorAPUrl, perl = TRUE)
   KorAPUrl <- regmatches(KorAPUrl, m)
   if (!endsWith(KorAPUrl, '/')) {
     KorAPUrl <- paste0(KorAPUrl, "/")
   }
-  if (is.na(apiUrl)) {
+  if (missing(apiUrl)) {
     apiUrl = paste0(KorAPUrl, 'api/', apiVersion, '/')
   }
   con <- data.frame(apiUrl, KorAPUrl, apiVersion)
diff --git a/R/KorAPCorpusStats.R b/R/KorAPCorpusStats.R
index 0714b28..fb30b5d 100644
--- a/R/KorAPCorpusStats.R
+++ b/R/KorAPCorpusStats.R
@@ -9,11 +9,11 @@
 #' @param vc string describing the virtual corpus. An empty string (default) means the whole corpus, as far as it is license-wise accessible.
 #' @export
 #' @return object with the fields \code{$documents}, \code{$tokens}, \code{$sentences}, \code{$paragraphs}
-KorAPCorpusStats <- function(con, vc = NA, query = NA) {
-  if ((is.na(query) && is.na(vc)) || !(is.na(query) || is.na(vc))) {
+KorAPCorpusStats <- function(con, vc, query) {
+  if ((missing(query) && missing(vc)) || !(missing(query) || missing(vc))) {
     stop("Exaclty one of the parameters query and vc must be specified.")
   }
-  if (is.na(vc)) {
+  if (missing(vc)) {
     vc = query$vc
   }
   url <- paste0(con$apiUrl, 'statistics?cq=', URLencode(vc, reserved=TRUE))
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index 3875bc2..79b589c 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -48,19 +48,16 @@
 #' \url{https://ids-pub.bsz-bw.de/frontdoor/index/index/docId/9026}
 #'
 #' @export
-KorAPQuery <- function(con, query = NA, vc = NA, KorAPUrl = NA, metadataOnly = TRUE, ql = "poliqarp", fields = defaultFields,
+KorAPQuery <- function(con, query, vc="", KorAPUrl, metadataOnly = TRUE, ql = "poliqarp", fields = defaultFields,
                        accessRewriteFatal = TRUE) {
-  if (is.na(query) && is.na(KorAPUrl) ||  ! (is.na(query) || is.na(KorAPUrl))) {
+  if (missing(query) && missing(KorAPUrl) ||  ! (missing(query) || missing(KorAPUrl))) {
     stop("Exactly one of the parameters query and KorAPUrl must be specified.")
   }
-  if (is.na(query)) {
+  if (missing(query)) {
     query <- QueryParameterFromUrl(KorAPUrl, "q")
     vc <- QueryParameterFromUrl(KorAPUrl, "vc")
     ql <- QueryParameterFromUrl(KorAPUrl, "ql")
   }
-  if (is.na(vc)) {
-    vc <- ""
-  }
   request <- paste0('?q=', URLencode(query, reserved=TRUE),
                     ifelse(vc != '', paste0('&vc=', URLencode(vc, reserved=TRUE)), ''),
                     '&ql=', ql);
diff --git a/man/KorAPConnection.Rd b/man/KorAPConnection.Rd
index b62aa80..a3ba70f 100644
--- a/man/KorAPConnection.Rd
+++ b/man/KorAPConnection.Rd
@@ -5,7 +5,7 @@
 \title{Connect to a KorAP server.}
 \usage{
 KorAPConnection(KorAPUrl = defaultKorAPUrl, apiVersion = "v1.0",
-  apiUrl = NA)
+  apiUrl)
 }
 \arguments{
 \item{KorAPUrl}{instead of providing the query and vc string parameters, you can also simply copy a KorAP query URL from your browser and use it here (and in \code{KorAPConnection}) to provide all necessary information for the query.}
diff --git a/man/KorAPCorpusStats.Rd b/man/KorAPCorpusStats.Rd
index 218eb77..71066b2 100644
--- a/man/KorAPCorpusStats.Rd
+++ b/man/KorAPCorpusStats.Rd
@@ -4,7 +4,7 @@
 \alias{KorAPCorpusStats}
 \title{Fetch information about a (virtual) corpus}
 \usage{
-KorAPCorpusStats(con, vc = NA, query = NA)
+KorAPCorpusStats(con, vc, query)
 }
 \arguments{
 \item{con}{object obtained from \code{\link{KorAPConnection}}}
diff --git a/man/KorAPQuery.Rd b/man/KorAPQuery.Rd
index fc68d15..89ea8fe 100644
--- a/man/KorAPQuery.Rd
+++ b/man/KorAPQuery.Rd
@@ -4,9 +4,8 @@
 \alias{KorAPQuery}
 \title{Send a query to a KorAP connection.}
 \usage{
-KorAPQuery(con, query = NA, vc = NA, KorAPUrl = NA,
-  metadataOnly = TRUE, ql = "poliqarp", fields = defaultFields,
-  accessRewriteFatal = TRUE)
+KorAPQuery(con, query, vc = "", KorAPUrl, metadataOnly = TRUE,
+  ql = "poliqarp", fields = defaultFields, accessRewriteFatal = TRUE)
 }
 \arguments{
 \item{con}{object obtained from \code{\link{KorAPConnection}}, that contains all necessary connection information}