Reputation: 2270
When I try to display the contents of a dataframe, I am getting some strange output (see the screenshot below). I am using head()
here but the behavior is the same for any display of a dataframe.
The behavior only seems present in RStudio. As shown below, my base installation of R behaves as expected.
My sessionInfo is as follows:
> 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_
Any thoughts as to what is going on?
UPDATE
In response to Hong Ooi, I am displaying the results of getAnywhere("print.data.frame")[1:2]
below.
$`package:base`
function (x, ..., digits = NULL, quote = FALSE, right = TRUE,
row.names = TRUE)
{
n <- 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("<0 rows> (or 0-length row.names)\n"))
}
else {
m <- as.matrix(format.data.frame(x, digits = digits,
na.encode = FALSE))
if (!isTRUE(row.names))
dimnames(m)[[1L]] <- if (identical(row.names, FALSE))
rep.int("", n)
else row.names
print(m, ..., quote = quote, right = right)
}
invisible(x)
}
<bytecode: 0x0000000009f8e570>
<environment: namespace:base>
[[2]]
function (x, ..., digits = NULL, quote = FALSE, right = TRUE,
row.names = TRUE)
{
n <- 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("<0 rows> (or 0-length row.names)\n"))
}
else {
m <- as.matrix(format.data.frame(x, digits = digits,
na.encode = FALSE))
if (!isTRUE(row.names))
dimnames(m)[[1L]] <- if (identical(row.names, FALSE))
rep.int("", n)
else row.names
print(m, ..., quote = quote, right = right)
}
invisible(x)
}
<bytecode: 0x0000000009f8e570>
<environment: namespace:base>
Upvotes: 2
Views: 264
Reputation: 2270
I am not sure which one worked, I upgraded RStudio from v0.97.551 to v0.98.447 and upgraded R from 3.0.1 to 3.0.2. One of these upgrades appears to have fixed my problem and my dataframes are printing normally again :)
Upvotes: 1
Reputation: 263321
You are in an RScript window. The double asterisks and  
are RMarkdown "punctuation". The sessionInfo() detail is not going to be as helpful in understanding RStudio's behavior as would be describing exactly the sequence of actions you executed with the GUI.
Upvotes: 0