On Tue, Jul 17, 2012 at 10:55 AM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
In general, you use assign() to do that, but having object names
containing spaces should be avoided.
mytext <- "Experiment name : CONTROL DB AD_1"
mytext
[1] "Experiment name : CONTROL DB AD_1"
mytext <- sub("Experiment name : ", "", mytext)
mytext
assign(mytext, 1:10)
ls()
[1] "CONTROL DB AD_1" "mytext"
Error: unexpected symbol in "CONTROL DB"
Since you can't access your object by typing its name at the R prompt,
either with or without quotes, you've kind of got a problem. You could
use get(), but at that point why not just name your object something
that follows the R naming conventions?
I know Sarah knows this, but just for archive completeness: backticks.