打印" (双引号)在R中使用sprintf

时间:2018-01-05 15:47:00

标签: r

如何使用val df1 = df.withColumn("X_Field", when( $"category" === "incident" and $"origin" === "phone" and ($"close_time" >= StartTime and $"close_time" <= EndTime), 1).otherwise(0) ) 中的"在我的文字周围打印sprintf

示例:

R

输出为:

Name<-"X"
sprintf({"%s"},Name)

但我需要

[1] "X"

2 个答案:

答案 0 :(得分:2)

我认为你想要的是<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script> <div class="container"> <center> <h2>How will the 'Savvy Club' help?</h2> <br /> </center> <div id="wrapper"> <div class="row"> <div class="col-md-6"> <p>The ‘Savvy Package’ has been created through a thorough knowledge of both Social Media and an understanding of what businesses need. This understanding has been learnt from us going up and dow the country delivering our informative and no holds barred workshop. We soon noticed that we left people inspired yet overwhelmed.</p> <br /> <br /> <p>The Savvy club is for businesses who are serious about seeing results through Social Media. We deliver support through webinars and workshops. Our Facebook Group delivers support and information giving members opportunity to share thoughts and experiences.</p> <br /> <br /> <p><b>Consider the Savvy Club as the helpful, in house digital expert you never had.</b></p> </div> <div class="col-md-6"> <div class="square"> <b>Stay On Top of Changes</b> <br /> <p>One of the primary challenges for Social media marketing is that the tools are always changing. We help you keep up with the changes, thanks to a weekly webinars.</p> </div> <br /> <div class="square"> <b>Quick Access to Help</b> <br /> <p>Our Savvy Guru’s are on hand to answer any question that comes through the Group giving you the confidence to broadcast with confidence.</p> </div> <br /> <div class="square"> <b>Sharpen Your Skills with Training</b> <br /> <p>You’ll have immediate access to all Wisdom Wednesday replays we have delivered via the group, Ideal for binge viewing. We liken it to Netflix for digital strategy.</p> </div> <br /> <div class="square"> <b>Support on Content</b> <br /> <p>Knowing what to post and when can sometimes be a problem. Our content calendar briefing will guide you or inspire you on which direction your content should take.</p> </div> <br /> <div class="square2"> <b>Someone to speak to</b> <br /> <p>The first year of The Savvy’s delivery there was something missing although you could get questions answered via the group - the opportunity to brain storm and sound out ideas was missing. We have answered this with the second tier of the Savvy Package and called it pro. (Savvy Pro only).</p> </div> </div> </div> </div> </div>你可以做到

shQuote

请注意,R需要转义控制台中的内部引号。它不会打印出类似shQuote(Name) # [1] "\"X\"" 的内容。但是如果你""X""这些值不是斜杠那么

cat

答案 1 :(得分:0)

我不确定是否有其他选项会对您有所帮助。但你可以考虑一下:

选项可以是:

Name<-"X"
#> sprintf("'%s'",Name)
#[1] "'X'"