s-news
[Top] [All Lists]

[S] aa <- c(aa,1.4) how to exclude/ignore first component aa since unde

To: s-news@wubios.wustl.edu
Subject: [S] aa <- c(aa,1.4) how to exclude/ignore first component aa since undefined?
From: Jameson Burt <jameson@user2.mnsinc.com>
Date: Thu, 22 Apr 1999 14:35:59 -0400 (EDT)
Cc: jameson@pressroom.com
Sender: owner-s-news@wubios.wustl.edu
I create a vector through a procedure simplified as
    for (i in intervals)   aa <- c(aa,ww[i])
Unfortunately, SPlus disallows adding a number to a vector that does not 
yet exist.
I could preceed this "for" line with
    aa <- numeric() 
so appending would work well.

However, it seems even this might be improved by something like
   for (i in interval)    aa <- c(front(aa),ww[i]
in the original statement above, for some concocted function "front" 
(made-up) that will ignore the component aa when undefined [it is not 
just "na" for which I might us is.na()].

Because I have programmed a great deal in unix shells and perl,
I frequently more easily program with the expectation that I can ignore
a variable when it is missing.
Is there a function like my concocted front(aa) that would ignore a 
variable when missing, but use it when present?

Thank you,
Jim Burt
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] aa <- c(aa,1.4) how to exclude/ignore first component aa since undefined?, Jameson Burt <=