使用带有变量r的表达式 [英] Use expression with a variable r

查看:127
本文介绍了使用带有变量r的表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试图用以下标签标注一个情节:一些测试EC50(uM),其中u是微量符号。



我目前有:

 测定<  - 一些测定
plot(0,xlab = expression(paste(assay,assay,AC50(,muM),sep =)))

但是,这表示:测定EC50(uM),而不是所需的一些测定EC50(uM)。



建议?谢谢。



我也尝试过:

  (AC50(,mu,M),sep =)),b = div class =h2_lin>解决方案

你想要组合 bquote()和一些plotmath fu:

 测定<  - 某些测定
xlab< - bquote(。(assay)〜AC50〜(mu * M))
图(0,xlab = xlab)

是一个间距运算符, * 意味着将内容并置到运算符的左侧和右侧。在 bquote()中,包裹在。()中的任何东西都将被查找并替换为命名对象的值;所以。(assay)将在表达式中被替换为 Some Assay


I am trying to label a plot with the following label:

"Some Assay EC50 (uM)" where the "u" is a micro symbol.

I currently have:

assay <- "Some Assay"
plot(0,xlab=expression(paste(assay," AC50 (",mu,"M)",sep="")))

But that gives: "assay EC50 (uM)" rather than the desired "Some Assay EC50 (uM)".

Suggestions? Thanks.

I also tried:

paste(assay,expression(paste(" AC50 (",mu,"M)",sep="")),sep="")

解决方案

You want a combination of bquote() and a bit of plotmath fu:

assay <- "Some Assay"
xlab <- bquote(.(assay) ~ AC50 ~ (mu*M))
plot(0, xlab = xlab)

The ~ is a spacing operator and * means juxtapose the contents to the left and right of the operator. In bquote(), anything wrapped in .( ) will be looked up and replaced with the value of the named object; so .(assay) will be replaced in the expression with Some Assay.

这篇关于使用带有变量r的表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆