transform string to symbol similar to the parsing behaviour of readtable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

transform string to symbol similar to the parsing behaviour of readtable

Christian Groll
I have an array of strings which I want to transform into an array of symbols. However, my array does contain strings like "foo. bar", which become symbol("foo. bar")

If such strings occur as header in a csv file, readtable transforms these strings into symbols without "_" or ".", and "foo. bar" becomes :foo_bar. Is there a function to replicate this behaviour?

--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: transform string to symbol similar to the parsing behaviour of readtable

K Leo
I guess :foo. bar in a statement would cause some confusion.

On 2014年08月06日 17:00, Christian Groll wrote:

> I have an array of strings which I want to transform into an array of
> symbols. However, my array does contain strings like "foo. bar", which
> become symbol("foo. bar")
>
> If such strings occur as header in a csv file, readtable transforms
> these strings into symbols without "_" or ".", and "foo. bar" becomes
> :foo_bar. Is there a function to replicate this behaviour?
> --
> You received this message because you are subscribed to the Google
> Groups "julia-stats" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email]
> <mailto:[hidden email]>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: transform string to symbol similar to the parsing behaviour of readtable

Johan Sigfrids
In reply to this post by Christian Groll
I suppose you could just reuse the function in DataFrames.

DataFrames.identifier("foo.bar") # => :foo_bar

On Wednesday, August 6, 2014 12:00:36 PM UTC+3, Christian Groll wrote:
I have an array of strings which I want to transform into an array of symbols. However, my array does contain strings like "foo. bar", which become symbol("foo. bar")

If such strings occur as header in a csv file, readtable transforms these strings into symbols without "_" or ".", and "foo. bar" becomes :foo_bar. Is there a function to replicate this behaviour?

--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: transform string to symbol similar to the parsing behaviour of readtable

Christian Groll
thanks! that is just what I was looking for!

On Wednesday, 6 August 2014 15:20:43 UTC+2, Johan Sigfrids wrote:
I suppose you could just reuse the function in DataFrames.

DataFrames.identifier("foo.bar") # => :foo_bar

On Wednesday, August 6, 2014 12:00:36 PM UTC+3, Christian Groll wrote:
I have an array of strings which I want to transform into an array of symbols. However, my array does contain strings like "foo. bar", which become symbol("foo. bar")

If such strings occur as header in a csv file, readtable transforms these strings into symbols without "_" or ".", and "foo. bar" becomes :foo_bar. Is there a function to replicate this behaviour?

--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.