jakobbossek/tspgen

Warning ‘BBmisc’ The following object is masked from ‘package:base’: isFALSE

jiang-yuan opened this issue · 10 comments

R 4.2.0
tspgen is installed by devtool.


Loading required package: BBmisc

Attaching package: ‘BBmisc’

The following object is masked from ‘package:base’:

    isFALSE

Loading required package: mvtnorm
Loading required package: lhs
Loading required package: checkmate
Error in file(file, ifelse(append, "a", "w")) :
  cannot open the connection
Calls: exportToTSPlibFormat -> write -> cat -> file
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file 'data/TSP/explosion/1.tsp': No such file or directory
Execution halted

Hi, I cannot reproduce this with R 4.1.1.
Please provide 1) the code that yields this error and 2) the output of sessionInfo() in a running R session.

I try R 3.6.3, it also shows the same warning, but it is only a warning. I can get expected running results.

library("netgen")
source("tspgen-master/R/utilities.R")

x = generateRandomNetwork(n.points = 50, lower = 0, upper = 1)
exportToTSPlibFormat(x, 'name', use.extended.format=FALSE)

output:

Rscript test.R
Loading required package: BBmisc

Attaching package: ‘BBmisc’

The following object is masked from ‘package:base’:
isFALSE
Loading required package: mvtnorm
Loading required package: lhs
Loading required package: checkmate

sessionInfo:

sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

locale:
[1] LC_CTYPE=en_SG.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_SG.UTF-8 LC_COLLATE=en_SG.UTF-8
[5] LC_MONETARY=en_SG.UTF-8 LC_MESSAGES=en_SG.UTF-8
[7] LC_PAPER=en_SG.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_SG.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.6.3

OK. I will check it with R 4.2.0 as soon as my time permits.
Glad it works for you with an older R version.

Thank you.
I checked the exportToTSPlibFormat file and found it uses BBmisc, so I guess the connection error may come from BBmisc. However, it is a permission problem of my destination folder, the connection error is fixed now for both 3.6.3 and 4.2.0.
The only problem left is the BBmisc warning now.

Ok, but the BBmisc warning is no problem at all. Actually, such warning arise quite often when packages are loaded. It just says, that there is a function isFALSE in BBmisc that masks an existing base R function with the same name. So if you want to access the base R function you need to call it via base::isFalse(...).

Yes. It just verbosely occupies the shell window in the loop of my program.

I see. You could try to temporarily deactivate warnings, e.g., via

ow = getOption("warn")
options(warn = -1)
% Your code goes here
options(warn = ow)

OK. Thank you~

One more question:
I create a 2 cluster tsp instance by applying cluster mutator twice on uniform instance. It it the correct usage?
The cluster mutator seems cannot specify the number of clusters.

This is not the way it is meant to be used. If you want k (spherical) clusters I suggest to use, e.g., my package netgen as follows:

library(netgen)
library(ggplot2)
x = generateClusteredNetwork(n.points = 100, n.cluster = 2)
autoplot(x)