s-news
[Top] [All Lists]

assign() with variable names

To: "S-PLUS Newsgroup (E-mail)" <s-news@lists.biostat.wustl.edu>
Subject: assign() with variable names
From: "Winifred Lambert" <winnie@ccb.ensco.com>
Date: Fri, 17 Nov 2000 17:40:27 -0500
S-PLUS 2000 Windows 2000

I am writing a script that must loop through several object names and
perform the stepwise() command.  Here is the sequence and result:

outname <- paste("MyOut.", i, sep="")  # i is the looping variable
inname <- paste("MyIn.", i, sep="")  #  The MyIn.i data frames already
exist
last <- count.cols(get(inname))      #  Number of columns vary between
data frames
assign(outname, stepwise(get(inname)[,2:last], get(inname)[,1],
f.crit=10))

After the assign() statement, the word NULL is output, but the values in
MyOut.i look fine.  When I do the command normally in the Commands
window, i.e.

>MyOut.1 <- stepwise(MyIn.1[,2:last], MyIn.1[,1], f.crit=10)

the word NULL is not output.  Since MyOut.i looks fine after the
assign() statement, I probably shouldn't complain.  But the programmer
in me does not like to see anything unusual and would like it explained.
Is there something very wrong with what I've done here as far as S-Plus
commands are concerned?

******************************************************
Winifred C. Lambert, Senior Scientist/Meteorologist
ENSCO Inc.
Aerospace Sciences and Engineering Division
1980 N Atlantic Ave, Suite 230
Cocoa Beach, FL 32931
VOICE: 321.853.8130  FAX: 321.853.8415
lambert.winifred@ensco.com

AMU Quarterly Reports on the Web:
http://technology.ksc.nasa.gov/WWWaccess/AMU/home.html
******************************************************


<Prev in Thread] Current Thread [Next in Thread>
  • assign() with variable names, Winifred Lambert <=