From hpages at fhcrc.org  Sat Apr 19 04:17:26 2008
From: hpages at fhcrc.org (Herve Pages)
Date: Fri, 18 Apr 2008 19:17:26 -0700
Subject: [Rd] Pb with package::foo(x) <- value
Message-ID: <48095636.2040500@fhcrc.org>

Hi,

The parser doesn't seem to like this:

   somePackage::foo(x) <- value
   somePackage:::foo(x) <- value

where foo() is a replacement function or method defined in package somePackage.

For example:

   > x <- integer(4)
   > base::length(x) <- 7
   Error in base::length(x) <- 7 : invalid function in complex assignment

I've tried to put some back quotes on the left side of the assignment in
different ways but was not successful. So finally I had to use the
non-replacement form:

   > x <- base::`length<-`(x, 7)
   > x
   [1]  0  0  0  0 NA NA NA

Is there a way to avoid this?

Thanks!
H.



[Rd] Pb with package::foo(x) <- value
Herve Pages