ggvis, error in function( ) : attempt to apply non-function : post sessionInfo() - r

library("dplyr")
library("ggvis")
mtcars %>% ggvis(~wt,~mpg) %>% layer_points()
sessionInfo()
I posted sessionInfo() because I have an Error in (function () : attempt to apply non-function.
When I use R markdown and run, it works. It has error all the time, when I run it in R.

I had a similar issue to this.
I updated Rstudio from ver 0.98.1102 to ver 0.98.1103 and it's working now
Test to see if you can get ggvis to work in vanilla R to see if it's Rstudio behind your problem
Good Luck

Related

Issue running across on dplyr on R 1.4.1103

When running this simple code :
freq_table <- ques %>%
select(across(starts_with("Q36_"))) %>%
table()
I get the following error message :
across()` must only be used inside dplyr verbs
I have restarted R and reloaded dplyr but the problem remains. Any clues why?
Thanks!

Error: in m_str_extents_(x, fontname, fontsize, bold, italic, fontfile) : function 'Rcpp_precious_remove' not provided by package 'Rcpp' [duplicate]

This question already has answers here:
Rcpp package doesn't include Rcpp_precious_remove
(2 answers)
Closed 1 year ago.
I'm using tbl_summary function with as_flex_table() under R version 4.0.5 (2021-03-31) and Rstudio Version 1.4.1106 in a R-Markdown project with successfull results. But when I try using the same .Rmd under R version 4.1.0 (2021-05-18) and Rstudio Version 1.4.1717 I get the following error. "Error: in m_str_extents_(x, fontname, fontsize, bold, italic, fontfile) : function 'Rcpp_precious_remove' not provided by package 'Rcpp'" . I get this error when I use the function as_flex_table() only. Someone knows if the are uncompatibility issues.
Please help me
table1 <- tbl_summary (data, by=trt)) %>%
add_n() %>%
add_p() %>%
modify_header(label = "**Variable**") %>%
add_overall() %>%
modify_caption("Patient Characteristics") %>%
as_flex_table()
The problematic function m_str_extents_() is from gdtools. So likely you have a recent version or gdtools compiled against an older version of Rccp. Try updating Rccp to version 1.0.7 with install.packages() and with a bit of hope it should work.
install.packages("Rcpp")
For reference same problem described on Rccp mailing list which can summarised with
TL;DR: update your library.

How to call View() / utils::View() in a function as part of a package?

I am writing a function for a package that ends with a call to utils::View(). The aim of the function is to do some data wrangling and then open the dataset in the Rstudio data viewer with View(). If I define the function in the global environment it works fine. As an example (skipping the data wrangling part):
foo <- function(x) {
View(x)
}
foo(mtcars)
opens the dataset mtcars in the data viewer. However, once I put it in my r package and call the function as part of that package it does issue the following error:
"Error in .External2(C_dataviewer, x, title) : unable to start data viewer
In addition: Warning message:
In utils::View(mtcars) : unable to open display"
I have tried to use utils::View() or simply View(), without success. Also, I have tried it with XQuartz uninstalled and with XQuartz installed and couldn't make it work.
I am using Rstudio version 1.0.153 and
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
I am grateful for any hints on how to resolve this!
Try using View(df) instead utils::View(df)
or try restarting the session (Ctrl +shft +F10)
then again using View(df)
or use dpylr to convert it into a table then use glimpse
-----------------------Code-------------------------------------------
install.packages("dyplr")
dplyr::tbl_df(mtcars) #to convert data to table class
dplyr::glimpse(mtcars)

Error in get_sentiments function

Has anyone used 'tidytextmining' for sentiment analysis in R?
Tidytextmining
I am using R V 3.4.1 and I am getting the following error for this piece of code.
library(tidytext)
library(dplyr)
get_sentiments("afinn")
Error - Error in get_sentiments("afinn") :
could not find function "get_sentiments"
I have the right package installed and the library reference. What am I missing?
I tried your code and it's working just fine. Are you sure you have the right library reference? I would double-check!

ggvis, Error in normalizedPath()

I am running one of the "interactive" examples from the ggvis webpage (http://ggvis.rstudio.com/ggvis-basics.html#introduction) and I obtain an error.
I loaded the ggvis, dplyr and shiny packages.
Here is the code that I ran:
mtcars %>% ggvis(~wt) %>% layer_histograms(binwidth = input_slider(0, 2, step = 0.1))
And here is the output that I get.
Showing dynamic visualisation. Press Escape/Ctrl + C to stop.
Error in normalizePath(directoryPath, mustWork = TRUE) :
path[1]="/Builds/CRAN-QA-Simon/packages/mavericks-x86_64/Rlib/3.1/ggvis/www/ggvis": No such file or directory
I am using RStudio Version 0.98.507, and R version 3.1.0; Platform: x86_64-apple-darwin13.1.0 (64-bit).
I just found a similar thing trying to run a shiny app from RStudio.
My workaround was to devtools::install_packages("rstudio/ggvis").
I'll put a link to this from the ggvis google group.
Hope this helps

Resources