[R] Check for is.object
Jonathan P Daily
jdaily at usgs.gov
Mon Nov 22 17:02:55 CET 2010
I think you want the function ?exists
>if(!exists("NewObject"))
--------------------------------------
Jonathan P. Daily
Technician - USGS Leetown Science Center
11649 Leetown Road
Kearneysville WV, 25430
(304) 724-4480
"Is the room still a room when its empty? Does the room,
the thing itself have purpose? Or do we, what's the word... imbue it."
- Jubal Early, Firefly
r-help-bounces at r-project.org wrote on 11/22/2010 10:14:51 AM:
> [image removed]
>
> [R] Check for is.object
>
> Santosh Srinivas
>
> to:
>
> r-help
>
> 11/22/2010 10:17 AM
>
> Sent by:
>
> r-help-bounces at r-project.org
>
> Hello,
>
> I am trying to recursively append some data from multiple files into a
> common object
>
> For this, I am using in a loop
>
> NewObject <- rbind(NewObject,tempObject)
>
>
> For the first loop, obviously there is no NewObject ... so I wanted to
do
> NewObject <- tempObject[0,]
>
> Now when it loops again I want to put the statement do "NewObject <-
> tempObject[0,]" inside a if statement ... so that it does I can skip it
once
> NewObject has been initialized.
>
> But, is.object doesn't seem to work.
>
> What is the alternative check that I can do? And is there a better way
to
> achieve what I want?
>
> Thanks,
> S
>
> ______________________________________________
> 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