[R] Strange error on text assignment to variable

Sumitrajit Dhar s-dhar at northwestern.edu
Wed Jan 22 08:00:30 CET 2014

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.


More information about the R-help mailing list