Convert R Object to Text Representation
Examples
objectToText(1:10)
#> [1] "1:10"
objectToText((1:10)[-5])
#> [1] "c(1L, 2L, 3L, 4L, 6L, 7L, 8L, 9L, 10L)"
cat(objectToText(head(iris)))
#> structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4), Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9), Petal.Length = c(1.4, 1.4, 1.3, 1.5, 1.4, 1.7), Petal.Width = c(0.2, 0.2, 0.2, 0.2, 0.2, 0.4), Species = structure(c(1L, 1L, 1L, 1L, 1L, 1L), levels = c("setosa", "versicolor", "virginica"), class = "factor")), row.names = c(NA, 6L), class = "data.frame")