Duncan Murdoch
2022-Jan-05 19:51 UTC
[R] Error: if statement: missing value where TRUE/FALSE needed
On 05/01/2022 2:09 p.m., Ivan Krylov wrote:> On Wed, 5 Jan 2022 21:22:37 +0300 > Ivan Krylov <krylov.r00t at gmail.com> wrote: > >> How exactly do you check for a missing argument? > > To answer my own question, the check is > >>> browser(expr = { >>> is.na(w1) | is.na(ub) | is.na(m) | is.na(wi) | is.na(lb) >>> }) > > I think that there are NAs in xseg, which I don't see a check for. In > particular, a few lines above, there's > >>> md = median( xseg, na.rm = TRUE); >>> if (robust) sdd = mad(xseg,na.rm = TRUE) >>> else sdd = sd(xseg,na.rm = TRUE) > > ...which seems to suggest they are expected to happen there. > > Not sure which advice to give regarding the choice of file hosting > service. On the one hand, SourceForge lets you upload a whole directory > of files in arbitrary formats, but isn't very convenient do download > more than one file from. On the other hand, "pastebin" services like > http://paste.debian.net/ or http://paste.org.ru/ let us browse the code > right away, without having to look at the "Your download will start > shortly..." screen, but don't host *.RData or more than one file per > link. I guess that some other code hosting service like > SourceHut/GitHub/GitLab/Gitea/... could fulfil both criteria.I would take one step back, and suggest that if any project has as many scripts as this one, it should be put in an R package. You can distribute that by building it into a tar.gz file and putting that single file in a place where people can download it. Github and R-forge work well for packages, and I assume other hosting services do too, though I haven't used many. People seem to be unreasonably reluctant to put their code into packages. Duncan Murdoch
Chuck Coleman
2022-Jan-06 15:23 UTC
[R] Error: if statement: missing value where TRUE/FALSE needed
I've created a git repository at?https://sourceforge.net/p/rhelp/code/ci/master/tree/.? I've used git before, so that's what I chose.? I had forgotten that sourceforge didn't have a download all files command.? I don't post files often. About the semantics of "crash":? Perhaps I'm showing my age here.? It used to be that programs crashed, bombed, etc. when they hit unanticipated errors.? These programs lived in a OS without an intermediary.? Now, we have programs of programs running within multiple applications on multiple servers with multiple OSs.? Since I'm not a programmer by profession, I've had little need to use these constructs. Chuck Coleman On Wednesday, January 5, 2022, 02:51:07 PM EST, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: On 05/01/2022 2:09 p.m., Ivan Krylov wrote:> On Wed, 5 Jan 2022 21:22:37 +0300 > Ivan Krylov <krylov.r00t at gmail.com> wrote: > >> How exactly do you check for a missing argument? > > To answer my own question, the check is > >>> browser(expr = { >>>? is.na(w1) | is.na(ub) | is.na(m) | is.na(wi) | is.na(lb) >>> }) > > I think that there are NAs in xseg, which I don't see a check for. In > particular, a few lines above, there's > >>> md = median( xseg, na.rm = TRUE); >>> if (robust) sdd = mad(xseg,na.rm = TRUE) >>> else sdd = sd(xseg,na.rm = TRUE) > > ...which seems to suggest they are expected to happen there. > > Not sure which advice to give regarding the choice of file hosting > service. On the one hand, SourceForge lets you upload a whole directory > of files in arbitrary formats, but isn't very convenient do download > more than one file from. On the other hand, "pastebin" services like > http://paste.debian.net/ or http://paste.org.ru/ let us browse the code > right away, without having to look at the "Your download will start > shortly..." screen, but don't host *.RData or more than one file per > link. I guess that some other code hosting service like > SourceHut/GitHub/GitLab/Gitea/... could fulfil both criteria.I would take one step back, and suggest that if any project has as many scripts as this one, it should be put in an R package.? You can distribute that by building it into a tar.gz file and putting that single file in a place where people can download it.? Github and R-forge work well for packages, and I assume other hosting services do too, though I haven't used many. People seem to be unreasonably reluctant to put their code into packages. Duncan Murdoch