search for: badfun

Displaying 3 results from an estimated 3 matches for "badfun".

2020 Feb 26
3
unlink() on "~" removes the home directory
...~" directory, and then your home is gone. But you would not create a directory named "~", that is just asking for trouble. Well, surely, _intentionally_ you would not do that. Unintentionally, you might. E.g. something like this is enough: # Create a subpath within a base directory badfun <- function(base = ".", path) { dir.create(file.path(base, path), recursive = TRUE, showWarnings = FALSE) } badfun(path = "~/foo") (If you did run this, be very careful how you remove the directory called "~"!) A real example is `R CMD build` which deletes the h...
1997 Jun 06
1
R-beta: nlm
I am trying to use the function "nlm" to find the mle. I want to use a generic function for the likelihood which would require me to use both the parameters and the data as arguments. But nlm requires the function to have only the parameters as arguments for this function (see example below). > testfun <- function(x,y) sum((x-y)^2) # x - parameters, y - data >
2020 Mar 23
0
unlink() on "~" removes the home directory
...home is gone. > > But you would not create a directory named "~", that is just asking > for trouble. Well, surely, _intentionally_ you would not do that. > Unintentionally, you might. E.g. something like this is enough: > > # Create a subpath within a base directory > badfun <- function(base = ".", path) { > dir.create(file.path(base, path), recursive = TRUE, showWarnings = FALSE) > } > badfun(path = "~/foo") > > (If you did run this, be very careful how you remove the directory called "~"!) > > A real example is...