[R] assign data to objects

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Mar 21 08:14:45 CET 2001


On Tue, 20 Mar 2001, Yu-Ling Wu wrote:

> Hi,
>
> I want to write the data returning from each loop to
> temp1, temp2, ... , temp10. However, I got error
> message as below:
>
> Error: Target of assignment expands to non-language
> object
>
> Please help me with this.
>
> Thanks,
> Yu-Ling Wu
>
> ==CODE===============================================
>
> stime = 23
>
> for (i in 1:10) {
> paste("temp", i, sep="") <- sqlQuery(myConnect,
> paste("select action, count from DB1 where utime=",
> stime, " group by action")

try

query <- paste("select action, count from DB1 where utime=", stime,
" group by action")
assign(paste("temp", i, sep=""), sqlQuery(myConnect, query))

> stime = stime + 60
> }
> =====================================================
>




-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list