Quantcast

Mystery!!!

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Mystery!!!

arun.gurubaramurugeshan
I am executing the following loops in R 15.1.0 and the first one works and produces results. However, the second one is not with initiating the object as x[i]. Further, I was able to get the second loop work in R 15.0. Am I missing something here?

for(i in 1:length(b))
{y[i]<-paste(a,b[i],c,sep="")
print(y[i])
print(fromJSON(file=y[i],method="C"))
}

for(i in 1:length(b))
{x[i]<-paste(a,b[i],c,sep="")
print(x[i])
print(fromJSON(file=x[i],method="C"))
}


Thanks
Arun
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Mystery!!!

Bob O'Hara-2
I think the big mystery is how you got hold of R 15.1.0. :-)

(sorry, couldn't resist. Presumably you mean R2.15.x)

More seriously, I thinkwe would need to be told more, e.g. what are a, b,
and c? My guess is that you either have x or y defined already, so check to
see if they exist at the point in your code before these loops, and also
what they are (e.g. use str() to see what objects you have in your session).

It may be you'll have one of those "oh, duh" moments that's common to all
of us.

Bob

On 28 June 2012 15:51, arun.gurubaramurugeshan <
[hidden email]> wrote:

> I am executing the following loops in R 15.1.0 and the first one works and
> produces results. However, the second one is not with initiating the object
> as x[i]. Further, I was able to get the second loop work in R 15.0. Am I
> missing something here?
>
> for(i in 1:length(b))
> {y[i]<-paste(a,b[i],c,sep="")
> print(y[i])
> print(fromJSON(file=y[i],method="C"))
> }
>
> for(i in 1:length(b))
> {x[i]<-paste(a,b[i],c,sep="")
> print(x[i])
> print(fromJSON(file=x[i],method="C"))
> }
>
>
> Thanks
> Arun
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Mystery-tp4634758.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.
>



--
Bob O'Hara

Biodiversity and Climate Research Centre
Senckenberganlage 25
D-60325 Frankfurt am Main,
Germany

Tel: +49 69 798 40216
Mobile: +49 1515 888 5440
WWW:   http://www.bik-f.de/root/index.php?page_id=219
Blog: http://blogs.nature.com/boboh
Journal of Negative Results - EEB: www.jnr-eeb.org

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Loading...