循环遍历字符串作为ggplot的对象

时间:2018-01-30 14:46:36

标签: r loops ggplot2

我想写一个循环来在ggplot中生成多个图。但是,当ggplot接受对象名称时,循环将列名称作为字符串进行迭代。

例如:

select Title
    , max(case when FieldName = 'Creator Contact Name' then FieldValue end) as CreatorContactName
    , max(case when FieldName = 'Supplier Name' then FieldValue end) as SupplierName
    , max(case when FieldName = 'Legal Agreement Name' then FieldValue end) as LegalAgreementName
from PCM_MultiItems_Metadata 
WHERE PROFILEID = 254 
  and fieldname in ('Creator Contact Name','Supplier Name','Legal Agreement Name')
group by Title

知道如何才能正确运行此循环吗?

0 个答案:

没有答案