When I work with the tree package, I cannot access a part of its output from an Rmd document, but I can access it with the exact same code in the console. Please find an Rmd exemplifying the problem below and the HTML report with the session info attached.
---title: "tree::tree object cannot be accessed in editor, only in console"output: html_document---```{r setup, include=FALSE}knitr::opts_chunk$set(echo=TRUE)```#Setting up an example
Let's create some small data for a `tree::tree` approach:
```{r}rm(list=ls(all=TRUE))library(tree); set.seed(1)summary(x<-data.frame(Y=factor(rep(letters[1:2], each=250)),X1=c(runif(250, 1, 5), runif(250, 3, 7)),X2=c(runif(250, 5, 9), runif(250, 1, 5))))```
Running a tree on this is unproblematic:
```{r}summary(cart.1<- tree(Y~X1+X2, data=x))```
thank you for the report. I can reproduce your step.
As everything is working fine when knitting and rendering to HTML, this makes me thing it is a RStudio IDE issue. The feature to execute chunk by chunk if from the IDE support of Rmd document, specifically showing "Chunk Output Inline".
If you select, "Chunk Output in Console" , in the menu you'll see the expected output in console.
I would open the issue with reproducible example in the RStudio IDE repo so that they have a look.
I believe this is because cart.1$frame contains some columns which are several dimentions and not one vector.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
When I work with the tree package, I cannot access a part of its output from an Rmd document, but I can access it with the exact same code in the console. Please find an Rmd exemplifying the problem below and the HTML report with the session info attached.
tree_bug.pdf
Now the problem
If
One time, I saw the following error message in the editor pane:
But I wasn't able to reliably reporduce that one.
However, each of those lines will produce output when I copy and paste it into the console -- why??
The text was updated successfully, but these errors were encountered: