Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions R/peep.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ peep <- function(x, n = 6, digits = 4, r2c = FALSE) {
}

if (!is.data.frame(x)) {
x <- data.frame(x, check.names = FALSE)
x <- data.frame(x, check.names = FALSE, stringsAsFactors = FALSE)
}

# Subset to only the first and last 50 columns. There's a chance
Expand Down Expand Up @@ -123,7 +123,6 @@ peep <- function(x, n = 6, digits = 4, r2c = FALSE) {
if (length(columns) >= ncol(x)) {
out <- clipAndAddHorizontalDivider(x = x, dot = dot, n = n)

print(out)
return(out)
}

Expand All @@ -138,7 +137,8 @@ peep <- function(x, n = 6, digits = 4, r2c = FALSE) {
for (i in columns[-1]) {
const.out <- cbind(const.out, x[, i, drop = FALSE])
}
x <- do.call(cbind, const.out)

x <- const.out

x <- as.data.frame(x, stringsAsFactors = FALSE)
rownames(x) <- save.rownames
Expand All @@ -150,7 +150,5 @@ peep <- function(x, n = 6, digits = 4, r2c = FALSE) {
# Add horizontal divider.
out <- clipAndAddHorizontalDivider(x = x, dot = dot, n = n)

print(out)

return(invisible(out))
return(out)
}
18 changes: 11 additions & 7 deletions tests/testthat/valid_3rows
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
valid.3rows <- structure(list(mpg = c(16, 16, 19), cyl = c(6, 6, 4), disp = c(160,
160, 108), hp = c(110, 110, 93), drat = c(3.9, 3.9, 3.85), wt = c(2.62,
2.875, 2.32), qsec = c(16.46, 17.02, 18.61), ` ` = c("·", "·",
"·"), cyl.1 = c(6, 6, 4), disp.1 = c(160, 160, 108), hp.1 = c(110,
110, 93), drat.1 = c(3.9, 3.9, 3.85), drat.2 = c(3.9, 3.9, 3.85
), drat.3 = c(3.9, 3.9, 3.85)), row.names = c("1:", "2:", "3:"
), class = "data.frame")
valid.3rows <- structure(list(mpg = structure(c(16L, 16L, 19L), .Label = c("10.4",
"13.3", "14.3", "14.7", "15", "15.2", "15.5", "15.8", "16.4",
"17.3", "17.8", "18.1", "18.7", "19.2", "19.7", "21", "21.4",
"21.5", "22.8", "24.4", "26", "27.3", "30.4", "32.4", "33.9"), class = "factor"),
cyl = c(6, 6, 4), disp = c(160, 160, 108), hp = c(110, 110,
93), drat = c(3.9, 3.9, 3.85), wt = c(2.62, 2.875, 2.32),
qsec = c(16.46, 17.02, 18.61), ` ` = c("·", "·", "·"),
cyl.1 = c(6, 6, 4), disp.1 = c(160, 160, 108), hp.1 = c(110,
110, 93), drat.1 = c(3.9, 3.9, 3.85), drat.2 = c(3.9, 3.9,
3.85), drat.3 = c(3.9, 3.9, 3.85)), row.names = c("1:", "2:",
"3:"), class = "data.frame")
60 changes: 32 additions & 28 deletions tests/testthat/valid_extran
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
valid.extra.n <- structure(list(mpg = c("16", "16", "19", "17", "13", "12", "3",
"20", "·", "14", "22", "21", "23", "8", "15", "5", "17"), cyl = c("6",
"6", "4", "6", "8", "6", "8", "4", "·", "8", "4", "4", "4",
"8", "6", "8", "4"), disp = c("160", "160", "108", "258", "360",
"225", "360", "146.7", "·", "400", "79", "120.3", "95.1", "351",
"145", "301", "121"), hp = c("110", "110", "93", "110", "175",
"105", "245", "62", "·", "175", "66", "91", "113", "264", "175",
"335", "109"), drat = c("3.9", "3.9", "3.85", "3.08", "3.15",
"2.76", "3.21", "3.69", "·", "3.08", "4.08", "4.43", "3.77",
"4.22", "3.62", "3.54", "4.11"), wt = c("2.62", "2.875", "2.32",
"3.215", "3.44", "3.46", "3.57", "3.19", "·", "3.845", "1.935",
"2.14", "1.513", "3.17", "2.77", "3.57", "2.78"), ` ` = c("·",
"·", "·", "·", "·", "·", "·", "·", "·", "·", "·", "·",
"·", "·", "·", "·", "·"), cyl.1 = c("6", "6", "4", "6",
"8", "6", "8", "4", "·", "8", "4", "4", "4", "8", "6", "8",
"4"), disp.1 = c("160", "160", "108", "258", "360", "225", "360",
"146.7", "·", "400", "79", "120.3", "95.1", "351", "145", "301",
"121"), hp.1 = c("110", "110", "93", "110", "175", "105", "245",
"62", "·", "175", "66", "91", "113", "264", "175", "335", "109"
), drat.1 = c("3.9", "3.9", "3.85", "3.08", "3.15", "2.76", "3.21",
"3.69", "·", "3.08", "4.08", "4.43", "3.77", "4.22", "3.62",
"3.54", "4.11"), drat.2 = c("3.9", "3.9", "3.85", "3.08", "3.15",
"2.76", "3.21", "3.69", "·", "3.08", "4.08", "4.43", "3.77",
"4.22", "3.62", "3.54", "4.11"), drat.3 = c("3.9", "3.9", "3.85",
"3.08", "3.15", "2.76", "3.21", "3.69", "·", "3.08", "4.08",
"4.43", "3.77", "4.22", "3.62", "3.54", "4.11")), row.names = c("01:",
"02:", "03:", "04:", "05:", "06:", "07:", "08:", "", "25:", "26:",
"27:", "28:", "29:", "30:", "31:", "32:"), class = "data.frame")
valid.extra.n <- structure(list(mpg = structure(c(16L, 16L, 19L, 17L, 13L, 12L,
3L, 20L, 26L, 14L, 22L, 21L, 23L, 8L, 15L, 5L, 17L), .Label = c("10.4",
"13.3", "14.3", "14.7", "15", "15.2", "15.5", "15.8", "16.4",
"17.3", "17.8", "18.1", "18.7", "19.2", "19.7", "21", "21.4",
"21.5", "22.8", "24.4", "26", "27.3", "30.4", "32.4", "33.9",
"·"), class = "factor"), cyl = c("6", "6", "4", "6", "8", "6",
"8", "4", "·", "8", "4", "4", "4", "8", "6", "8", "4"), disp = c("160",
"160", "108", "258", "360", "225", "360", "146.7", "·", "400",
"79", "120.3", "95.1", "351", "145", "301", "121"), hp = c("110",
"110", "93", "110", "175", "105", "245", "62", "·", "175", "66",
"91", "113", "264", "175", "335", "109"), drat = c("3.9", "3.9",
"3.85", "3.08", "3.15", "2.76", "3.21", "3.69", "·", "3.08",
"4.08", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11"), wt = c("2.62",
"2.875", "2.32", "3.215", "3.44", "3.46", "3.57", "3.19", "·",
"3.845", "1.935", "2.14", "1.513", "3.17", "2.77", "3.57", "2.78"
), ` ` = c("·", "·", "·", "·", "·", "·", "·", "·", "·",
"·", "·", "·", "·", "·", "·", "·", "·"), cyl.1 = c("6",
"6", "4", "6", "8", "6", "8", "4", "·", "8", "4", "4", "4",
"8", "6", "8", "4"), disp.1 = c("160", "160", "108", "258", "360",
"225", "360", "146.7", "·", "400", "79", "120.3", "95.1", "351",
"145", "301", "121"), hp.1 = c("110", "110", "93", "110", "175",
"105", "245", "62", "·", "175", "66", "91", "113", "264", "175",
"335", "109"), drat.1 = c("3.9", "3.9", "3.85", "3.08", "3.15",
"2.76", "3.21", "3.69", "·", "3.08", "4.08", "4.43", "3.77",
"4.22", "3.62", "3.54", "4.11"), drat.2 = c("3.9", "3.9", "3.85",
"3.08", "3.15", "2.76", "3.21", "3.69", "·", "3.08", "4.08",
"4.43", "3.77", "4.22", "3.62", "3.54", "4.11"), drat.3 = c("3.9",
"3.9", "3.85", "3.08", "3.15", "2.76", "3.21", "3.69", "·",
"3.08", "4.08", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11"
)), row.names = c("01:", "02:", "03:", "04:", "05:", "06:", "07:",
"08:", "", "25:", "26:", "27:", "28:", "29:", "30:", "31:", "32:"
), class = "data.frame")
47 changes: 26 additions & 21 deletions tests/testthat/valid_full
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
valid.full <- structure(list(mpg = c("16", "16", "19", "17", "13", "12", "·",
"21", "23", "8", "15", "5", "17"), cyl = c("6", "6", "4", "6",
"8", "6", "·", "4", "4", "8", "6", "8", "4"), disp = c("160",
"160", "108", "258", "360", "225", "·", "120.3", "95.1", "351",
"145", "301", "121"), hp = c("110", "110", "93", "110", "175",
"105", "·", "91", "113", "264", "175", "335", "109"), drat = c("3.9",
"3.9", "3.85", "3.08", "3.15", "2.76", "·", "4.43", "3.77",
"4.22", "3.62", "3.54", "4.11"), wt = c("2.62", "2.875", "2.32",
"3.215", "3.44", "3.46", "·", "2.14", "1.513", "3.17", "2.77",
"3.57", "2.78"), ` ` = c("·", "·", "·", "·", "·", "·",
"·", "·", "·", "·", "·", "·", "·"), cyl.1 = c("6", "6",
"4", "6", "8", "6", "·", "4", "4", "8", "6", "8", "4"), disp.1 = c("160",
"160", "108", "258", "360", "225", "·", "120.3", "95.1", "351",
"145", "301", "121"), hp.1 = c("110", "110", "93", "110", "175",
"105", "·", "91", "113", "264", "175", "335", "109"), drat.1 = c("3.9",
"3.9", "3.85", "3.08", "3.15", "2.76", "·", "4.43", "3.77",
"4.22", "3.62", "3.54", "4.11"), drat.2 = c("3.9", "3.9", "3.85",
"3.08", "3.15", "2.76", "·", "4.43", "3.77", "4.22", "3.62",
"3.54", "4.11"), drat.3 = c("3.9", "3.9", "3.85", "3.08", "3.15",
"2.76", "·", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11")), row.names = c("01:",
"02:", "03:", "04:", "05:", "06:", "", "27:", "28:", "29:", "30:",
valid.full <- structure(list(mpg = structure(c(16L, 16L, 19L, 17L, 13L, 12L,
26L, 21L, 23L, 8L, 15L, 5L, 17L), .Label = c("10.4", "13.3",
"14.3", "14.7", "15", "15.2", "15.5", "15.8", "16.4", "17.3",
"17.8", "18.1", "18.7", "19.2", "19.7", "21", "21.4", "21.5",
"22.8", "24.4", "26", "27.3", "30.4", "32.4", "33.9", "·"), class = "factor"),
cyl = c("6", "6", "4", "6", "8", "6", "·", "4", "4", "8",
"6", "8", "4"), disp = c("160", "160", "108", "258", "360",
"225", "·", "120.3", "95.1", "351", "145", "301", "121"),
hp = c("110", "110", "93", "110", "175", "105", "·", "91",
"113", "264", "175", "335", "109"), drat = c("3.9", "3.9",
"3.85", "3.08", "3.15", "2.76", "·", "4.43", "3.77", "4.22",
"3.62", "3.54", "4.11"), wt = c("2.62", "2.875", "2.32",
"3.215", "3.44", "3.46", "·", "2.14", "1.513", "3.17", "2.77",
"3.57", "2.78"), ` ` = c("·", "·", "·", "·", "·", "·",
"·", "·", "·", "·", "·", "·", "·"), cyl.1 = c("6",
"6", "4", "6", "8", "6", "·", "4", "4", "8", "6", "8", "4"
), disp.1 = c("160", "160", "108", "258", "360", "225", "·",
"120.3", "95.1", "351", "145", "301", "121"), hp.1 = c("110",
"110", "93", "110", "175", "105", "·", "91", "113", "264",
"175", "335", "109"), drat.1 = c("3.9", "3.9", "3.85", "3.08",
"3.15", "2.76", "·", "4.43", "3.77", "4.22", "3.62", "3.54",
"4.11"), drat.2 = c("3.9", "3.9", "3.85", "3.08", "3.15",
"2.76", "·", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11"
), drat.3 = c("3.9", "3.9", "3.85", "3.08", "3.15", "2.76",
"·", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11")), row.names = c("01:",
"02:", "03:", "04:", "05:", "06:", "", "27:", "28:", "29:", "30:",
"31:", "32:"), class = "data.frame")
46 changes: 25 additions & 21 deletions tests/testthat/valid_r2c
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
valid.r2c <- structure(list(rn = c("Mazda RX4", "Mazda RX4 Wag", "Datsun 710",
"Hornet 4 Drive", "Hornet Sportabout", "Valiant", "·", "Porsche 914-2",
"Lotus Europa", "Ford Pantera L", "Ferrari Dino", "Maserati Bora",
"Volvo 142E"), mpg = c("16", "16", "19", "17", "13", "12", "·",
"21", "23", "8", "15", "5", "17"), cyl = c("6", "6", "4", "6",
"8", "6", "·", "4", "4", "8", "6", "8", "4"), disp = c("160",
"160", "108", "258", "360", "225", "·", "120.3", "95.1", "351",
"145", "301", "121"), hp = c("110", "110", "93", "110", "175",
"105", "·", "91", "113", "264", "175", "335", "109"), ` ` = c("·",
"·", "·", "·", "·", "·", "·", "·", "·", "·", "·", "·",
"·"), disp.1 = c("160", "160", "108", "258", "360", "225", "·",
"120.3", "95.1", "351", "145", "301", "121"), hp.1 = c("110",
"110", "93", "110", "175", "105", "·", "91", "113", "264", "175",
"335", "109"), drat.1 = c("3.9", "3.9", "3.85", "3.08", "3.15",
"2.76", "·", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11"),
drat.2 = c("3.9", "3.9", "3.85", "3.08", "3.15", "2.76",
"·", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11"), drat.3 = c("3.9",
"3.9", "3.85", "3.08", "3.15", "2.76", "·", "4.43", "3.77",
"4.22", "3.62", "3.54", "4.11")), row.names = c("01:", "02:",
"03:", "04:", "05:", "06:", "", "27:", "28:", "29:", "30:", "31:",
"32:"), class = "data.frame")
valid.r2c <- structure(list(rn = c("Mazda RX4", "Mazda RX4 Wag", "Datsun 710",
"Hornet 4 Drive", "Hornet Sportabout", "Valiant", "·", "Porsche 914-2",
"Lotus Europa", "Ford Pantera L", "Ferrari Dino", "Maserati Bora",
"Volvo 142E"), mpg = structure(c(16L, 16L, 19L, 17L, 13L, 12L,
26L, 21L, 23L, 8L, 15L, 5L, 17L), .Label = c("10.4", "13.3",
"14.3", "14.7", "15", "15.2", "15.5", "15.8", "16.4", "17.3",
"17.8", "18.1", "18.7", "19.2", "19.7", "21", "21.4", "21.5",
"22.8", "24.4", "26", "27.3", "30.4", "32.4", "33.9", "·"), class = "factor"),
cyl = c("6", "6", "4", "6", "8", "6", "·", "4", "4", "8",
"6", "8", "4"), disp = c("160", "160", "108", "258", "360",
"225", "·", "120.3", "95.1", "351", "145", "301", "121"),
hp = c("110", "110", "93", "110", "175", "105", "·", "91",
"113", "264", "175", "335", "109"), ` ` = c("·", "·",
"·", "·", "·", "·", "·", "·", "·", "·", "·", "·",
"·"), disp.1 = c("160", "160", "108", "258", "360", "225",
"·", "120.3", "95.1", "351", "145", "301", "121"), hp.1 = c("110",
"110", "93", "110", "175", "105", "·", "91", "113", "264",
"175", "335", "109"), drat.1 = c("3.9", "3.9", "3.85", "3.08",
"3.15", "2.76", "·", "4.43", "3.77", "4.22", "3.62", "3.54",
"4.11"), drat.2 = c("3.9", "3.9", "3.85", "3.08", "3.15",
"2.76", "·", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11"
), drat.3 = c("3.9", "3.9", "3.85", "3.08", "3.15", "2.76",
"·", "4.43", "3.77", "4.22", "3.62", "3.54", "4.11")), row.names = c("01:",
"02:", "03:", "04:", "05:", "06:", "", "27:", "28:", "29:", "30:",
"31:", "32:"), class = "data.frame")