Hello folks, I am using R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin10.8.0 (64-bit) on Mac OS 10.9.1 When I try a simple assignment as below, the first "For" works but the second "for" gives me an error.> P_for <- expression(P[For]) > P_for <- expression(P[for])Error: unexpected ']' in "P_for <- expression(P[for]" I have tested the following to work just fine:> P_for <- expression(P[For]) > P_for <- expression(P[F]) > P_for <- expression(P[f]) > P_for <- expression(P[fo]) > P_for <- expression(P[Fo]) > P_for <- expression(P[or])Thanks for any help you can provide. Regards, Sumit
Frede Aakmann Tøgersen
2014-Jan-22 07:07 UTC
[R] Strange error on text assignment to variable
Hi Well, for is a basic control-flow construct and as such a reserved word in R. See e.g. ?for Yours sincerely / Med venlig hilsen Frede Aakmann T?gersen Specialist, M.Sc., Ph.D. Plant Performance & Modeling Technology & Service Solutions T +45 9730 5135 M +45 2547 6050 frtog at vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender.> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] > On Behalf Of Sumitrajit Dhar > Sent: 22. januar 2014 08:01 > To: r-help at r-project.org > Subject: [R] Strange error on text assignment to variable > > Hello folks, > > I am using > > R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" > Copyright (C) 2013 The R Foundation for Statistical Computing > Platform: x86_64-apple-darwin10.8.0 (64-bit) > > > on Mac OS 10.9.1 > > When I try a simple assignment as below, the first "For" works but the > second "for" gives me an error. > > > P_for <- expression(P[For]) > > P_for <- expression(P[for]) > Error: unexpected ']' in "P_for <- expression(P[for]" > > I have tested the following to work just fine: > > P_for <- expression(P[For]) > > P_for <- expression(P[F]) > > P_for <- expression(P[f]) > > P_for <- expression(P[fo]) > > P_for <- expression(P[Fo]) > > P_for <- expression(P[or]) > > Thanks for any help you can provide. > > Regards, > Sumit > > ______________________________________________ > 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.