[R] functions from 'base' package are not accessible

Eugeny Melamud Eugeny.Melamud at lanit-tercom.com
Thu Aug 24 13:32:05 CEST 2017


Hi all!

The following code (executed in console)...
    somevar <- data.frame(v1 = 1:5, somestring = 6:10, v3 = 11:15, v4 = 16:20);
    somevar %>% gather(key = var, value = val, which(names(somevar) == "somestring"):length(somevar)) %>% head(2);
throws...
    Error in which(names(somevar) == "somestring") :
      could not find function "which"

if I change which(names(somevar) == "somestring") with 0 I'll get
   Error in length(somevar) :
      could not find function "length"

So it looks like base package is not loaded. Still if type 'which' in console I get
  function (x, arr.ind = FALSE, useNames = TRUE)
  {
    wh <- .Internal(which(x))
    if (arr.ind && !is.null(d <- dim(x)))
        arrayInd(wh, d, dimnames(x), useNames = useNames)
    else wh
  }
  <bytecode: 0x0000000006c6e258>
  <environment: namespace:base>

base (that contains which function) package is installed. R version is 3.4.1 and system is Win8

Where should I look to understand how to fix the problem?

Thank you in advance!
Eugeny


	[[alternative HTML version deleted]]



More information about the R-help mailing list