[R] Extending a vector

Stephen C. Upton upton at mitre.org
Fri Apr 2 23:52:21 CEST 2004


Marko,

Looks fine to me. Why do you think the syntax is incorrect? Works for me in
1.8 on Windows.
> a <- 1
> a
[1] 1
> a <- c(a,2)
> a
[1] 1 2
> a <- c(a,2,4,5)
> a
[1] 1 2 2 4 5
> 

steve

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Mark O. Kimball
Sent: Friday, April 02, 2004 4:27 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Extending a vector


I believe this should be an easy thing to do...

I have a function I repeatably call which takes input parameters and
outputs columns to various data frames. I also wish to keep a summary of
certain values as I call the function. I though keeping the values in a
vector then appending the vector by the new amounts would be the way to
do this.

Example: (this is what I want even thought the below syntax is wrong)

a <- 1
print(a) --> 1

a <- c(a,2)
print(a) --> 1,2

a <- c(a,2,4,5)
print(a) --> 1,2,2,4,5

Any help would be greatly appreciated...

Marko
-- 
Mark O. Kimball
Gasparinilab, University of Buffalo  |  Low temp physics
mok2 at physics.buffalo.edu  |  URL: enthalpy.physics.buffalo.edu
lab phone: 716-645-2017x122  Fax: 716-645-2507

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list