On 10/08/2018 12:01 AM, Rodrigo Tobar wrote:
Dear all,
I want to create a temporary directory from within my C++ R extension.
On the other hand, CRAN's policy dictates that one cannot write anything
outside the boundaries of the session's temporary directory, so I need
to create it exactly there
Hello,
I know it's good practice to use
if (require("some_package")) {
# some code that needs some_package
}
In R examples that needs a package listed in Suggests.
The problem with this approach is that if there are any print statements
within this structure, then they only get printed after
Hi Zhian,
Could you please explain what behaviour you would like to obtain?
I really don't understand what your problem is from your description...
Alex
On Fri, 10 Aug 2018 at 12:18, Zhian Kamvar wrote:
> Hello,
>
> I know it's good practice to use
>
> if (require("some_package")) {
> # some c
Mainly, I would like to see the value printed after the print statement
like it would appear in a normal R session:
print("Hi")
#> [1] "Hi"
print("Hello")
#> [1] "Hello"
print("Goodbye")
#> [1] "Goodbye"
On Fri, Aug 10, 2018 at 11:28 AM Alexandre Courtiol <
alexandre.court...@gmail.com> wrote:
Perhaps then something like:
Print <- function(x) if (requireNamespace("some.package", quietly = TRUE))
print(x)
Print("Hi")
Print("Hello")
Print("Goodbye")
On Fri, 10 Aug 2018 at 12:33, Zhian Kamvar wrote:
> Mainly, I would like to see the value printed after the print statement
> like it wou
Thanks, but my use of print here is really a toy example, not necessarily
the end-goal. This strategy would fail if I were to attempt load a data set
from some_package or use any functions from some_package.
A more specific example of what I'm dealing with is here:
http://www.repidemicsconsortium.
Maybe Martin Maechler's post in response to a similar question answers your
question:
https://stat.ethz.ch/pipermail/r-package-devel/2018q2/002780.html
In summary, wrap the code in:
if (requireNamespace("MASS", quietly = TRUE)) withAutoprint({
your code
})
Georgi Boshnakov
-O
This was what I was looking for! Thank you!
I apologize for my insufficient google-fu today.
On Fri, Aug 10, 2018 at 12:55 PM Georgi Boshnakov <
georgi.boshna...@manchester.ac.uk> wrote:
> Maybe Martin Maechler's post in response to a similar question answers
> your question:
>
> https://stat.e
Hi,
On 10.08.18 3:10 PM, Duncan Murdoch wrote:
On 10/08/2018 12:01 AM, Rodrigo Tobar wrote:
[...]
Why not pass the result of tempdir() in your call from R to your C++
function, or in an initialization call for your package? It won't
change during a session.
This is indeed a good suggesti