Sri krishna Devarayalu Balanagu
2012-Sep-18 09:40 UTC
[R] Why x[1] is not getting substituted?
Suppose I want the output as "Trial and a sheet" without quotes x=c("a", "b", "c") print("Trial and x[1] sheet") Getting "Trial and x[1] sheet" Can anyone help? Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-66929999<tel:+91-40-66929999> and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). [[alternative HTML version deleted]]
> paste("Trial and",x[1],"sheet")[1] "Trial and a sheet"> cat("Trial and",x[1],"sheet")Trial and a sheet On 18.09.2012, at 11:40, Sri krishna Devarayalu Balanagu wrote:> Suppose I want the output as "Trial and a sheet" without quotes > x=c("a", "b", "c") > print("Trial and x[1] sheet") > > Getting "Trial and x[1] sheet" > > Can anyone help? > Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-66929999<tel:+91-40-66929999> and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hi, Try this: ?paste("Trial and",x[1], "sheet",collapse=" ") #[1] "Trial and a sheet" A.K. ----- Original Message ----- From: Sri krishna Devarayalu Balanagu <balanagudevarayulu at gvkbio.com> To: "r-help at r-project.org" <r-help at r-project.org> Cc: Sent: Tuesday, September 18, 2012 5:40 AM Subject: [R] Why x[1] is not getting substituted? Suppose I want the output as "Trial and a sheet" without quotes x=c("a", "b", "c") print("Trial and x[1] sheet") Getting? "Trial and x[1] sheet" Can anyone help? Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-66929999<tel:+91-40-66929999> and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Hi because you need to evaluate it. print(paste("Trial and" ,eval(x[1]), "sheet")) Regards Petr> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Sri krishna Devarayalu Balanagu > Sent: Tuesday, September 18, 2012 11:41 AM > To: r-help at r-project.org > Subject: [R] Why x[1] is not getting substituted? > > Suppose I want the output as "Trial and a sheet" without quotes > x=c("a", "b", "c") print("Trial and x[1] sheet") > > Getting "Trial and x[1] sheet" > > Can anyone help? > Notice: The information contained in this electronic mail message is > intended only for the use of the designated recipient. This message is > privileged and confidential. and the property of GVK BIO or its > affiliates and subsidiaries. If the reader of this message is not the > intended recipient or an agent responsible for delivering it to the > intended recipient, you are hereby notified that you have received this > message in error and that any review, dissemination, distribution, or > copying of this message is strictly prohibited. If you have received > this communication in error, please notify us immediately by telephone > +91-40-66929999<tel:+91-40-66929999> and destroy any and all copies of > this message in your possession (whether hard copies or electronically > stored copies). > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.
On Sep 19, 2012, at 6:26 AM, PIKAL Petr wrote:> Hi > > because you need to evaluate it. > > print(paste("Trial and" ,eval(x[1]), "sheet"))The eval is superfluous, since paste() already evaluates its unquoted arguments.> print(paste("Trial and", x[1], "sheet"))[1] "Trial and a sheet" -- David.> > Regards > Petr > > >> -----Original Message----- >> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- >> project.org] On Behalf Of Sri krishna Devarayalu Balanagu >> Sent: Tuesday, September 18, 2012 11:41 AM >> To: r-help at r-project.org >> Subject: [R] Why x[1] is not getting substituted? >> >> Suppose I want the output as "Trial and a sheet" without quotes >> x=c("a", "b", "c") print("Trial and x[1] sheet") >> >> Getting "Trial and x[1] sheet" >> >> Can anyone help? >> Notice: The information contained in this electronic mail message is >> intended only for the use of the designated recipient. This message is >> privileged and confidential. and the property of GVK BIO or its >> affiliates and subsidiaries. If the reader of this message is not the >> intended recipient or an agent responsible for delivering it to the >> intended recipient, you are hereby notified that you have received this >> message in error and that any review, dissemination, distribution, or >> copying of this message is strictly prohibited. If you have received >> this communication in error, please notify us immediately by telephone >> +91-40-66929999<tel:+91-40-66929999> and destroy any and all copies of >> this message in your possession (whether hard copies or electronically >> stored copies). >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting- >> guide.html >> and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD Alameda, CA, USA
Apparently Analagous Threads
- Why the error is coming, can anyone help?
- How can I get the Ids with Duplicated key and corresponding Ids with original key?
- How can we compare two vectors?
- I want to send the vector a into the Object A.......
- Can anyone help why the errors are coming and rectify it?