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);