I want to create an output with a bullet point for each entry
Data
I have one (and only one) row from my data frame:
structure(list(Dimensions = 2L, Continuity = structure(2L, .Label = c("",
"continuous"), class = "factor"), Differentiability = structure(2L, .Label = c("",
"differentiable", "non-differentiable"), class = "factor"), Convexity = structure(2L, .Label = c("",
"convex", "non-convex"), class = "factor"), Modality = structure(3L, .Label = c("",
"multimodal", "unimodal"), class = "factor"), Separability = structure(2L, .Label = c("",
"non-separable", "non-separable,", "separable"), class = "factor"),
Scalability = structure(2L, .Label = c("", "non-scalable",
"scalable"), class = "factor"), Parametric = FALSE, Random = FALSE), row.names = 2L, class = "data.frame")
Approach
mapply(function(x, y) cat("* ", y, ": ", as.character(x), "\n"), Descr, names(Descr))
Desired Output
* Dimensions : 2
* Continuity : continuous
* Differentiability : differentiable
* Convexity : convex
* Modality : unimodal
* Separability : non-separable
* Scalability : non-scalable
* Parametric : FALSE
* Random : FALSE
Actual Result
I am pretty close to what I want. However, R does not only print the desired part it adds the list of all columns afterwards. So the output looks like this:
* Dimensions : 2
* Continuity : continuous
* Differentiability : differentiable
* Convexity : convex
* Modality : unimodal
* Separability : non-separable
* Scalability : non-scalable
* Parametric : FALSE
* Random : FALSE
$Dimensions
NULL
$Continuity
NULL
$Differentiability
NULL
$Convexity
NULL
$Modality
NULL
$Separability
NULL
$Scalability
NULL
$Parametric
NULL
$Random
NULL
More than just a solution that works I would very much appreciate if anyone can give me a hint what happens here.