I don't have a reproducible example, but I do have some debugging information that might help @kevinushey figure out where the issue is coming from.
I have an R Markdown document where the first chunk is:
library(readr)
metadata <- read_csv("data/pannets_metadata.csv")
metadata
First, I terminate the R session to clear everything. When I run the chunk with Opt-Cmd-N (on macOS), I don't get a warning. When I then select the last line of the chunk (i.e. metadata
) and run it with Cmd-Enter to preview the data frame, I get the following warnings. As you can see, there is no ATRX_Expr
column in the metadata
data frame. Although, I used to use ATRX_Expr
as the name for ATRX_rnaseq
, but that's no longer the case. This makes me think it's a caching issue.
> metadata
Warning messages:
1: Unknown or uninitialised column: 'ATRX_Expr'.
2: Unknown or uninitialised column: 'ATRX_Expr'.
> colnames(metadata)
[1] "Tumour" "Age" "Sex" "Metastasis"
[5] "Tumour_purity" "Immune_score" "Subtype" "DAXX_mutant"
[9] "MEN1_mutant" "ATRX_mutant" "ATRX_rnaseq" "DAXX_rnaseq"
[13] "MEN1_rnaseq" "ATRX_array" "DAXX_array" "MEN1_array"
The above behaviour can be reproduced if I terminate R, clear all outputs, run that chunk with Opt-Cmd-N, and run metadata
with Cmd-Enter. If I terminate R but don't clear all outputs first, I don't get the warnings. Strangely, if I terminate R and clear all outputs but run the chunk with Opt-Cmd-C (rather than Opt-Cmd-N), I don't get the warnings most of the time. I've tried a few times and each outcome is reproducible, even after I completely quit and re-open RStudio.
Sometimes, I have to click Cmd-Enter on metadata
a few times before getting the warnings. Subsequent runs of metadata
with Cmd-Enter don't cause the warnings.
It's worth noting that if I run the same three lines of code at the console directly within RStudio, I don't get any warnings regardless of how many times I re-run metadata
to preview the data frame. This suggests that it's an R Markdown issue.
I tried deleting the .Rproj.user
folder associated with the RStudio project in question. I deleted the folder while RStudio wasn't running. After re-opening RStudio, I could reproduce the warnings using the steps described above. I even tried deleting all of RStudio's preferences in ~/Library
and ~/.config/
, but the warnings persisted.
All of these tests were done with RStudio version 1.3 (not the latest version). I couldn't get the warnings to manifest themselves with version 1.2.5042. When I installed the latest version of RStudio (version 1.3.1056), I started getting the warnings again. The issues seems specific to RStudio version 1.3.