Could someone please explain to me my mal-understanding of the
following, which I expected to give the same results without errors.

TIA.

-- Bert

> z <-  list(x=1)
> z[[2]] <- 3
> z
$x
[1] 1

[[2]]
[1] 3

> list(x = 1)[[2]] <- 3
Error in list(x = 1)[[2]] <- 3 :
  target of assignment expands to non-language object
>
> sessionInfo()

R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.2 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] utils    datasets tools    stats    graphics splines  grid
methods  base

other attached packages:
[1] nlme_3.1-122    lattice_0.20-33

loaded via a namespace (and not attached):
[1] grDevices_3.2.3 strucplot_0.5



Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to