Dear folks--
Suppose I have an expression that evaluates to a string, and that that
string, were it not a character vector, would be a symbol. I would like a
function, call it doppel(), that will take that expression as an argument
and produce something that functions exactly like the symbol
I believe I answered this a few weeks ago at this link:
https://stat.ethz.ch/pipermail/r-help/2012-November/328053.html and
following.
Michael
On Sun, Dec 2, 2012 at 2:43 PM, rahul143 rk204...@gmail.com wrote:
Dear folks--
Suppose I have an expression that evaluates to a string, and that that
On Wed, Nov 28, 2012 at 3:06 AM, andrewH ahoer...@rprogress.org wrote:
Dear Michael –
This is _very_ interesting and I want to play around with the functions you
suggest. I had no idea it was so easy to define assignment operators.
However, one question: even after reading the “get”
Yes, I meant FAQ 7.21, must have stuttered in typing, but it is always good
to read other FAQs while looking for a specific one.
I did read your full description, though whether I fully understand or not
is yet to be seen.
It seems like a lot of what you want to do could be simplified by using
In addition, if you go the route of a data frame then the functions to look
at are tapply, aggregate, and ave.
On Wed, Nov 28, 2012 at 2:02 PM, Greg Snow 538...@gmail.com wrote:
Yes, I meant FAQ 7.21, must have stuttered in typing, but it is always
good to read other FAQs while looking for a
Thanks so much Greg!
I'm going to take all these suggestions -- yours, jim holtman's, Michael
Weylandt's, and several others, and spend a couple of days trying them out
to see if I can make them work. I'll report back.
I'm going to have to look especially closely at loglin -- not primarily
Dear Michael –
This is _very_ interesting and I want to play around with the functions you
suggest. I had no idea it was so easy to define assignment operators.
However, one question: even after reading the “get” documentation and doing
a bunch of mousing around for the expressions “pos” and
Dear Greg—
You mean FAQ 7.21, not 7.22, correct? Though 7.12 also seems relevant.
Though I would say I was asking about turning a string into an expression
rather than a variable. At any rate, thanks for the pointer. I sure I would
benefit from rereading the FAQ on a monthly basis, until I
Others have shown you ways to do what you asked, and what you asked happens
to also be FAQ 7.22 (but with terms different enough that that FAQ is not
obvious).
However the solutions that you are tending towards are running into the
problems addressed in fortune(106) and fortune(236), the
On Sun, Nov 4, 2012 at 3:10 AM, andrewH ahoer...@rprogress.org wrote:
Yes, the assign command goes a little way toward what what I was hoping for.
But it requires a different syntax, and it does not in general let you use
quoted expressions that you could use with other assignment operators.
, 2012 11:10 PM
Subject: Re: [R] Can you turn a string into a (working) symbol?
Yes, the assign command goes a little way toward what what I was hoping for.
But it requires a different syntax, and it does not in general let you use
quoted expressions that you could use with other assignment
Dear folks--
Suppose I have an expression that evaluates to a string, and that that
string, were it not a character vector, would be a symbol. I would like a
function, call it doppel(), that will take that expression as an argument
and produce something that functions exactly like the symbol
Is this what you want (the answer you wanted is not correct):
aa - 3.1416
bb - function(x) {x^2}
r - 2
xx - c(aa, bb)
doppel - function(x) get(x)
out - doppel(xx[1])*doppel(xx[2])(r)
out
[1] 12.5664
On Sat, Nov 3, 2012 at 5:31 PM, andrewH ahoer...@rprogress.org wrote:
Dear
for the second part use 'assign'
assign(paste0('a', 'a'), 3)
aa
[1] 3
On Sat, Nov 3, 2012 at 5:31 PM, andrewH ahoer...@rprogress.org wrote:
Dear folks--
Suppose I have an expression that evaluates to a string, and that that
string, were it not a character vector, would be a symbol. I
Ah! Excellent! That will be most useful. And sorry about the typo.
I found another function in a different discussion that also seems to work,
at least in most cases I have tried. I do not at all understand the
difference between the two.
doppel - function(x) {eval(parse(text=x))
However,
Yes, the assign command goes a little way toward what what I was hoping for.
But it requires a different syntax, and it does not in general let you use
quoted expressions that you could use with other assignment operators. For
instance,
DD - 1:3
assign(DD[2], 5)
DD
[1] 1 2 3
So I am still
16 matches
Mail list logo