I would discourage using <R> as the name of a column in a DataFrame. Part of the reason we’re using symbols now is that it will encourage people to use column names that are valid Julia variable names. If you stick to valid variable names, you’ll always be able to use metaprogramming tools like those employed to generate formulas for GLM’s.
— John On May 2, 2014, at 1:03 AM, Tomas Lycken <[email protected]> wrote: > :"<R>" for symbol("<R>") makes sense to me, so if it's not in the way of > anything else, I'm all for it. > > And yeah, :"<R>" == "<R>" returns true, so I don't see how this could really > make something impossible to do, which is possible today. I guess if there's > code out that quotes literal strings like that it'll break, but I doubt that > there's a lot of it... I have no idea how such a change would be implemented, > though, so I'm afraid I won't be of much help making it happen. > > // T > > On Friday, May 2, 2014 9:50:14 AM UTC+2, Stefan Karpinski wrote: > We talked at some point about making :"<R>" syntax for symbol("<R>") and > requiring something like :("<R>") to express the fairly useless operation of > quoting the string "<R>" (this is useless because the result is just the > string "<R>"). Barring some problem with this that I'm not thinking of, I'd > be in favor of such a change. > > > On Fri, May 2, 2014 at 3:14 AM, Tomas Lycken <[email protected]> wrote: > Sorry to hijack the thread, but since I stumbled over this problem myself (in > the same context) and didn't know about the `symbol("A")` syntax, this seems > like an appropriate place to ask: > > In the dataframe I was working with, I had one column named "R", and another > which I wanted to name "<R>". Using :R was no problem, but it's not possible > to refer to :<R> at all. (Try it in the REPL - it parses it as an incomplete > expression, and if I add something after I get an error "R not defined"...) > > I think it's cool that it's possible to define symbols from arbitrary strings > using e.g. `symbol("<R>")`, but it's kind of clunky that you can't refer to > them with the colon syntax once they're defined. Is there a way around this, > or do I have to simply "deal with it"? =) > > // T > > > On Thursday, May 1, 2014 7:24:05 AM UTC+2, Ivar Nesje wrote: > Symbols in Julia is a special form of strings that are faster for some > operations (like comparisons) and much slower for others. Julia uses symbols > internally to represent variable names. > You create a symbol from a string with the symbol("A") function, or the :A > syntax. > >
