Make documentation less class centric

and more beginner user friendly

Change-Id: Icaca61c3d6f71bc8bd76c0507499b662df39be7a
diff --git a/R/KorAPConnection.R b/R/KorAPConnection.R
index 1d567a8..f1f433d 100644
--- a/R/KorAPConnection.R
+++ b/R/KorAPConnection.R
@@ -5,28 +5,44 @@
 setClassUnion("listOrNULL", c("list", "NULL"))
 # setOldClass("httr2_oauth_client")
 
-#' Class KorAPConnection
+#' Connect to KorAP Server
 #'
-#' `KorAPConnection` objects represent the connection to a KorAP server.
-#' New `KorAPConnection` objects can be created by `KorAPConnection()`.
+#' `KorAPConnection()` creates a connection to a KorAP server for corpus queries.
+#' This is your starting point for all corpus analysis tasks.
 #'
+#' Use `KorAPConnection()` to connect, then `corpusQuery()` to search, and
+#' `fetchAll()` to retrieve results. For authorized access to restricted corpora,
+#' use `auth()` or provide an `accessToken`.
+#'
+#' @section Basic Workflow:
+#' ```r
+#' # Connect to KorAP
+#' kcon <- KorAPConnection()
+#'
+#' # Search for a term
+#' query <- corpusQuery(kcon, "Ameisenplage")
+#'
+#' # Get all results
+#' results <- fetchAll(query)
+#' ```
+#'
+#' @section Authorization:
+#' For access to restricted corpora, authorize your connection:
+#' ```r
+#' kcon <- KorAPConnection() |> auth()
+#' ```
+#'
+#' @details
+#' The KorAPConnection object contains various configuration slots for advanced users:
+#' KorAPUrl (server URL), apiVersion, accessToken (OAuth2 token),
+#' timeout (request timeout), verbose (logging), cache (local caching),
+#' and other technical parameters. Most users can ignore these implementation details.
+#'
+#' @family initialization functions
 #' @import R.cache
 #' @import utils
 #' @import methods
 #' @include logging.R
-#' @slot KorAPUrl        URL of the web user interface of the KorAP server used in the connection.
-#' @slot apiVersion      requested KorAP API version.
-#' @slot indexRevision   indexRevision code as reported from API via `X-Index-Revision` HTTP header.
-#' @slot apiUrl          full URL of API including version.
-#' @slot accessToken     OAuth2 access token.
-#' @slot oauthClient     OAuth2 client object.
-#' @slot oauthScope      OAuth2 scope.
-#' @slot authorizationSupported logical that indicates if authorization is supported/necessary for the current KorAP instance. Automatically set during initialization.
-#' @slot userAgent       user agent string used for connection the API.
-#' @slot timeout         timeout in seconds for API requests (this does not influence server internal timeouts)
-#' @slot verbose         logical that decides whether operations will default to be verbose.
-#' @slot cache           logical that decides if API calls are cached locally.
-#' @slot welcome         list containing HTTP response received from KorAP server welcome function.
 
 #' @export
 KorAPConnection <- setClass("KorAPConnection", slots = c(KorAPUrl = "character", apiVersion = "character", indexRevision = "characterOrNULL", apiUrl = "character", accessToken = "characterOrNULL", oauthClient = "ANY", oauthScope = "characterOrNULL", authorizationSupported = "logical", userAgent = "character", timeout = "numeric", verbose = "logical", cache = "logical", welcome = "listOrNULL"))
@@ -37,6 +53,8 @@
 kustvakt_auth_path <- "settings/oauth/authorize"
 
 
+#' Initialize KorAPConnection object
+#' @keywords internal
 #' @param .Object KorAPConnection object
 #' @param KorAPUrl URL of the web user interface of the KorAP server instance you want to access.
 #'   Defaults to the environment variable `KORAP_URL` if set and to the IDS Mannheim KorAP main instance
@@ -110,7 +128,6 @@
 #' kq@collectedMatches$snippet
 #' }
 #'
-#' @rdname KorAPConnection-class
 
 #' @export
 setMethod("initialize", "KorAPConnection", function(.Object,
@@ -177,6 +194,7 @@
 
 #' Persist current access token in keyring
 #'
+#' @family initialization functions
 #' @param kco KorAPConnection object
 #' @param accessToken access token to be persisted. If not supplied, the current access token of the KorAPConnection object will be used.
 #' @return KorAPConnection object.
@@ -216,6 +234,7 @@
 
 #' Clear access token from keyring and KorAPConnection object
 #'
+#' @family initialization functions
 #' @aliases clearAccessToken
 #' @import keyring
 #' @param kco KorAPConnection object
@@ -249,6 +268,7 @@
 
 #' Authorize RKorAPClient
 #'
+#' @family initialization functions
 #' @aliases auth
 #'
 #' @description
@@ -367,8 +387,9 @@
 ## quiets concerns of R CMD check re: the .'s that appear in pipelines
 utils::globalVariables(c("."))
 
+#' Internal API call method
+#' @keywords internal
 #' @aliases apiCall
-#' @rdname KorAPConnection-class
 #' @param kco KorAPConnection object
 #' @param url request url
 #' @param json logical that determines if JSON result is expected
@@ -494,13 +515,13 @@
 setGeneric("clearCache", function(kco) standardGeneric("clearCache"))
 
 #' @aliases clearCache
-#' @rdname KorAPConnection-class
 #' @export
 setMethod("clearCache", "KorAPConnection", function(kco) {
   R.cache::clearCache(dir = KorAPCacheSubDir())
 })
 
-#' @rdname KorAPConnection-class
+#' Display KorAPConnection object
+#' @keywords internal
 #' @param object KorAPConnection object
 #' @export
 setMethod("show", "KorAPConnection", function(object) {
diff --git a/R/KorAPCorpusStats.R b/R/KorAPCorpusStats.R
index 7789945..5acba71 100644
--- a/R/KorAPCorpusStats.R
+++ b/R/KorAPCorpusStats.R
@@ -1,28 +1,40 @@
-#' Class KorAPCorpusStats
+#' KorAPCorpusStats class (internal)
 #'
-#' `KorAPCorpusStats` objects can hold information about a corpus or virtual corpus.
-#' `KorAPCorpusStats` objects can be obtained by the [corpusStats()] method.
+#' Internal class for corpus statistics storage. Users work with `corpusStats()` function instead.
 #'
+#' @keywords internal
 #' @include KorAPConnection.R
 #' @include logging.R
 #'
 #' @export
-#' @slot vc definition of the virtual corpus
-#' @slot tokens number of tokens
-#' @slot documents number of documents
-#' @slot sentences number of sentences
-#' @slot paragraphs number of paragraphs
-#' @slot webUIRequestUrl link to the web user interface with the current vc definition
 setClass("KorAPCorpusStats", slots = c(vc = "character", documents = "numeric", tokens = "numeric", sentences = "numeric", paragraphs = "numeric", webUIRequestUrl = "character"))
 
 setGeneric("corpusStats", function(kco, ...) standardGeneric("corpusStats"))
 
-#' Fetch information about a (virtual) corpus
+#' Get corpus size and statistics
+#'
+#' Retrieve information about corpus size (documents, tokens, sentences, paragraphs) 
+#' for the entire corpus or a virtual corpus subset.
+#'
+#' @section Usage:
+#' ```r
+#' # Get statistics for entire corpus
+#' kcon <- KorAPConnection()
+#' stats <- corpusStats(kcon)
+#' 
+#' # Get statistics for a specific time period
+#' stats <- corpusStats(kcon, "pubDate in 2020")
+#' 
+#' # Access the number of tokens
+#' stats@tokens
+#' ```
+#'
+#' @family corpus analysis
 #' @param kco [KorAPConnection()] object (obtained e.g. from `KorAPConnection()`
 #' @param vc string describing the virtual corpus. An empty string (default) means the whole corpus, as far as it is license-wise accessible.
 #' @param verbose logical. If `TRUE`, additional diagnostics are printed.
 #' @param as.df return result as data frame instead of as S4 object?
-#' @return `KorAPCorpusStats` object with the slots `documents`, `tokens`, `sentences`, `paragraphs`
+#' @return Object containing corpus statistics: `documents`, `tokens`, `sentences`, `paragraphs`
 #'
 #' @importFrom urltools url_encode
 #' @examples
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index f04e59d..9b77c39 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -1,9 +1,8 @@
-#' Class KorAPQuery
+#' KorAPQuery class (internal)
 #'
-#' This class provides methods to perform different kinds of queries on the KorAP API server.
-#' `KorAPQuery` objects, which are typically created by the [corpusQuery()] method,
-#' represent the current state of a query to a KorAP server.
+#' Internal class for query state management. Users work with `corpusQuery()`, `fetchAll()`, and `fetchNext()` instead.
 #'
+#' @keywords internal
 #' @include KorAPConnection.R
 #' @include logging.R
 #' @import httr2
@@ -25,9 +24,8 @@
   "hasMoreMatches"
 ))
 
-#' Method initialize
-#'
-#' @rdname KorAPQuery-class
+#' Initialize KorAPQuery object
+#' @keywords internal
 #' @param .Object …
 #' @param korapConnection KorAPConnection object
 #' @param request query part of the request URL
@@ -77,11 +75,11 @@
 ## quiets concerns of R CMD check re: the .'s that appear in pipelines
 utils::globalVariables(c("."))
 
-#' Corpus query
+#' Search corpus for query terms
 #'
 #' **`corpusQuery`** performs a corpus query via a connection to a KorAP-API-server
 #'
-#' @rdname KorAPQuery-class
+#' @family corpus search functions
 #' @aliases corpusQuery
 #'
 #' @importFrom urltools url_encode
@@ -383,6 +381,8 @@
 #'
 #' **`fetchNext`** fetches the next bunch of results of a KorAP query.
 #'
+#' @family corpus search functions
+#'
 #' @param kqo object obtained from [corpusQuery()]
 #' @param offset start offset for query results to fetch
 #' @param maxFetch maximum number of query results to fetch
@@ -403,7 +403,6 @@
 #' <https://ids-pub.bsz-bw.de/frontdoor/index/index/docId/9026>
 #'
 #' @aliases fetchNext
-#' @rdname KorAPQuery-class
 #' @importFrom dplyr rowwise mutate bind_rows select summarise n select
 #' @importFrom tibble enframe add_column
 #' @importFrom stringr word
@@ -698,6 +697,8 @@
 #'
 #' **`fetchAll`** fetches all results of a KorAP query.
 #'
+#' @family corpus search functions
+#'
 #' @examples
 #' \dontrun{
 #' # Fetch all metadata of every query hit for "Ameisenplage" and show a summary
@@ -723,7 +724,6 @@
 #' }
 #'
 #' @aliases fetchAll
-#' @rdname KorAPQuery-class
 #' @export
 setMethod("fetchAll", "KorAPQuery", function(kqo, verbose = kqo@korapConnection@verbose, ...) {
   return(fetchNext(kqo, offset = 0, maxFetch = NA, verbose = verbose, ...))
@@ -741,7 +741,6 @@
 #' }
 #'
 #' @aliases fetchRest
-#' @rdname KorAPQuery-class
 #' @export
 setMethod("fetchRest", "KorAPQuery", function(kqo, verbose = kqo@korapConnection@verbose, ...) {
   return(fetchNext(kqo, maxFetch = NA, verbose = verbose, ...))
@@ -754,6 +753,7 @@
 #' confidence intervals of one ore multiple search terms across one or multiple
 #' virtual corpora.
 #'
+#' @family frequency analysis
 #' @aliases frequencyQuery
 #' @examples
 #' \dontrun{
diff --git a/R/collocationAnalysis.R b/R/collocationAnalysis.R
index fe3ac2a..15daea9 100644
--- a/R/collocationAnalysis.R
+++ b/R/collocationAnalysis.R
@@ -3,6 +3,7 @@
 
 #' Collocation analysis
 #'
+#' @family collocation analysis functions
 #' @aliases collocationAnalysis
 #'
 #' @description
@@ -25,7 +26,6 @@
 #' This might lead to false negatives and to frequencies that differ from corresponding ones acquired via the web
 #' user interface.
 #'
-#' @family collocation analysis functions
 #'
 #' @param lemmatizeNodeQuery     if TRUE, node query will be lemmatized, i.e. `x -> [tt/l=x]`
 #' @param minOccur               minimum absolute number of observed co-occurrences to consider a collocate candidate