Closed CEH-SLU closed 8 months ago
The devices list on your computer reports 3 devices, which is not correctly handled since R4.0. The code should be something like any(names(dev.list()) != "postscript")
or all(names(dev.list()) != "postscript")
.
You could try to close all the graphical devices using dev.off()
before calling hist.data.frame again, which should open a graphical device for the plot.
Hope this help meanwhile a fix is available.
Thanks for the help, still get an error though...
Using RStudio I started a new session and loaded Hmisc. Running def.off() gives the following error: Error in dev.off() : cannot shut down device 1 (the null device)
running the example code gives almost the same error as before (now length=2): Error in automf && interactive() && names(dev.list()) != "postscript" : 'length = 2' in coercion to 'logical(1)'
The difference probably because I now ran the code in a script and before I clicked the 'Run examples' on the help page (within R-studio) after I had failed running another dataframe through hist.data.frame() in a script. Seems to work on the help page now if I have not tried it in the script and gotten the error before (also works if I have gotten the error and then cleared the devices before klicking the 'Run examples')
It is not necessary for me to get hist.data.fram() working so no need spending any time helping me with any workarounds :)
Best, Christofer
Thanks for the feedback. I guess a developer will solve this problem and check if there is no such problem in other of the code. Best, Samuel
Agreed on problem/solution, and submitted a pull request. Thanks!
Running the example from the help page for hist.data.frame gives the following error: Error in automf && interactive() && names(dev.list()) != "postscript": 'length = 3' in coercion to 'logical(1)'
(The example code:
d <- data.frame(a=runif(200), b=rnorm(200), w=factor(sample(c('green','red','blue'), 200, TRUE))) hist.data.frame(d) # in R, just say hist(d)
)
I get a similar error for other datasets when trying to show histograms for multiple variables.
R version 4.3.2, Hmisc 5.1-1
Kind regards, Christofer