d********p 发帖数: 31 | 1 请问如何将 R 的object 名变成 string。
Example:
x=20
y=object_to_string(x)
print ( paste('this is what I want:', y, '=', x) )
结果应当是:
this is what I want: x = 20 |
D*********2 发帖数: 535 | 2 sorry I do not get it.
Why can not u just
print ( paste('this is what I want: x =', x) )
or your x is a list of variable? Give a detailed example please. |
d********p 发帖数: 31 | 3
because it will be used in a loop, so in each iteration x will be different.
that is why.
thanks.
【在 D*********2 的大作中提到】 : sorry I do not get it. : Why can not u just : print ( paste('this is what I want: x =', x) ) : or your x is a list of variable? Give a detailed example please.
|
l*********s 发帖数: 5409 | 4 brother songkun provided the answer days ago: use eval(parse(text="x1")) . |
d********p 发帖数: 31 | 5
so great! thanks.
【在 l*********s 的大作中提到】 : brother songkun provided the answer days ago: use eval(parse(text="x1")) .
|