[R] how to append element at last position in array dynamically

R. Michael Weylandt michael.weylandt at gmail.com
Tue Feb 28 15:26:17 CET 2012


You need to reassign the value of append back to h -- in more
technical terms, this is a pass-by-value rather than pass-by-reference
behavior:

h <- append(h, 9)

This is not likely to be efficient in production code, however.

Michael

On Tue, Feb 28, 2012 at 7:15 AM, sagarnikam123 <sagarnikam123 at gmail.com> wrote:
>> h<-array()
>> h
> [1] NA
>> append(h,9)
> [1] NA  9
>
> but what it append.........
>> h
> [1] NA
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/how-to-append-element-at-last-position-in-array-dynamically-tp4427893p4427893.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.



More information about the R-help mailing list