Note that there are some explanatory texts on larger screens.

plurals
  1. POprint method is behaving strangely for dataframes
    primarykey
    data
    text
    <p>When I try to display the contents of a dataframe, I am getting some strange output (see the screenshot below). I am using <code>head()</code> here but the behavior is the same for any display of a dataframe. </p> <p><img src="https://i.stack.imgur.com/9FApM.png" alt="Screenshot of RStudio"></p> <p>The behavior only seems present in RStudio. As shown below, my base installation of R behaves as expected. </p> <p><img src="https://i.stack.imgur.com/VRYhk.png" alt="Screenshot of base R installation"></p> <p>My sessionInfo is as follows: </p> <pre><code>&gt; sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: _LC_COLLATE=English_United States.1252_, _LC_CTYPE=English_United States.1252_, _LC_MONETARY=English_United States.1252_, _LC_NUMERIC=C_ and _LC_TIME=English_United States.1252_ attached base packages: _stats_, _graphics_, _grDevices_, _utils_, _datasets_, _methods_ and _base_ loaded via a namespace (and not attached): _digest_0.6.3_, _pander_0.3.8_ and _tools_3.0.1_ </code></pre> <p>Any thoughts as to what is going on?</p> <p>UPDATE</p> <p>In response to Hong Ooi, I am displaying the results of <code>getAnywhere("print.data.frame")[1:2]</code> below. </p> <pre><code>$`package:base` function (x, ..., digits = NULL, quote = FALSE, right = TRUE, row.names = TRUE) { n &lt;- length(row.names(x)) if (length(x) == 0L) { cat(gettextf("data frame with 0 columns and %d rows\n", n)) } else if (n == 0L) { print.default(names(x), quote = FALSE) cat(gettext("&lt;0 rows&gt; (or 0-length row.names)\n")) } else { m &lt;- as.matrix(format.data.frame(x, digits = digits, na.encode = FALSE)) if (!isTRUE(row.names)) dimnames(m)[[1L]] &lt;- if (identical(row.names, FALSE)) rep.int("", n) else row.names print(m, ..., quote = quote, right = right) } invisible(x) } &lt;bytecode: 0x0000000009f8e570&gt; &lt;environment: namespace:base&gt; [[2]] function (x, ..., digits = NULL, quote = FALSE, right = TRUE, row.names = TRUE) { n &lt;- length(row.names(x)) if (length(x) == 0L) { cat(gettextf("data frame with 0 columns and %d rows\n", n)) } else if (n == 0L) { print.default(names(x), quote = FALSE) cat(gettext("&lt;0 rows&gt; (or 0-length row.names)\n")) } else { m &lt;- as.matrix(format.data.frame(x, digits = digits, na.encode = FALSE)) if (!isTRUE(row.names)) dimnames(m)[[1L]] &lt;- if (identical(row.names, FALSE)) rep.int("", n) else row.names print(m, ..., quote = quote, right = right) } invisible(x) } &lt;bytecode: 0x0000000009f8e570&gt; &lt;environment: namespace:base&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload