Closed grishin1 closed 7 years ago
tested it on mac now. works. i'll look under the hood later in the day to get it to work with windows
no probs, thank you.
it looks like it works on windows, it gets into trouble when it cant find a file to write to, and throws that warning
Well, having a previously saved file in the source editor and not being able to find it to write doesn't make sense to me. Simply because you can always have it at rstudioapi::getSourceEditorContext()$path
.
Your reply suggested that you've used to and always expect users to work from a package project with R files under ./R/ subdirectory whereas I've used to feeding the add-in assorted R files.
And indeed when I tried from a) package project b) .R files from ./R subdirectory then it worked (strangely did crash again on the first try). It doesn't work from, say Documents with .R files from R subdirectory.
Anyway, your assumption has caught me by surprise. It's not very obvious and needs to be documented if you want it that way. I would prefer to be able to process any R file, not necessarily from within a package. Now it's not possible just to try it out -- you have to create a package first and this makes threshold higher.
not sure i see where you are getting the error.
i can
I've tested on two Win 7/10 machines and here is what I see:
library(sinew)
and point the add-in at any .R file. (Again, not even from a package project, no project open (!) in Rstudio, arbitrary working directory). Now it's not the case, it crashes on pressing 'insert'.
Build & Reload
package before trying the add-in. Then it works for me.i still dont see it.
i just closed all projects, restarted a session, loaded sinew
wrote the fn zz
zz <- function(a=2){
utils::head(runif(10),a)
}
used the interactive addin, worked
#' @title FUNCTION_TITLE
#' @description FUNCTION_DESCRIPTION
#' @param a PARAM_DESCRIPTION, Default: 2
#' @return OUTPUT_DESCRIPTION
#' @details DETAILS
#' @examples
#' \dontrun{
#' if(interactive()){
#' #EXAMPLE1
#' }
#' }
#' @export
#' @rdname zz
#' @seealso
#'
#' @import utils
saved the file to an arbitrary location, reran the addin and it works for both moga and makeOxygen inserts.
#' @title FUNCTION_TITLE
#' @description FUNCTION_DESCRIPTION
#' @param a PARAM_DESCRIPTION, Default: 2
#' @return OUTPUT_DESCRIPTION
#' @details DETAILS
#' @examples
#' \dontrun{
#' if(interactive()){
#' #EXAMPLE1
#' }
#' }
#' @export
#' @rdname zz
#' @section SECTION_NAME
#' @seealso
#'
#' @import utils
i'll write a testthat script tonight to make it more formalized (even though i still dont know how testthat works with an interactive addin)
it would be useful now to get feedback from people using sinew.
got it to break.
I've submitted sinew to EARL, so hopefully it will get more user input.
breaks here. the main difference between what you had and what i had to change it to was to make it cran compatible. you wrote to globalEnv and that isnt allowed w cran pkgs. i rerouted everything to a temp environment.
Just confirming... Now works with random R files/locations. One thing I've noticed was it couldn't source a file where one function was made using purrr's compose
(no pkg;; prefixes by the way). The message was '...couldn't find function compose...'. After library(purrr)
it did work.
the addin searches any functions in the search path. so it would need to be loaded. not sure how to search for something not in the path yet.
added a patch for random namespaces. purrr::compose
should work now
I've installed the latest version and found that the interactive add-in is broken. Tried on 2 different machines with different files (Win only).
Listening on http://127.0.0.1:4424 Warning in file(con, "r") : file("") only supports open = "w+" and open = "w+b": using the former Warning: Error in eval: object 'zz' not found Stack trace (innermost first): 71: eval [#1]
70: eval
69:
68: do.call
67: observeEventHandler
3: shiny::runApp
2: shiny::runGadget
1: sinew:::interOxyAddIn
ERROR: [on_request_read] connection reset by peer