Hi all,
Suppose I have a vector
Fruits <-
c('Apple','Orange','Pear','Banana','Mango')
I want to print the statement
"The fruits in the basket are: Apple, Orange, Pear, Banana, Mango"
If I do:
print(paste('The fruits in the basket are:',Fruits))
The output is:
[1] "The fruits in the basket are: Apple" "The fruits in the
basket are:
Orange"
[3] "The fruits in the basket are: Pear" "The fruits in the
basket are:
Banana"
[5] "The fruits in the basket are: Mango"
Is there any easy ways to solve this problem? Thanks!
- Jackie
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Maybe not as easy as you wish, but this works:
> print(paste('The fruits in the basket
are:',paste(Fruits,collapse=" ")))
[1] "The fruits in the basket are: Apple Orange Pear Banana Mango"
>
Cheers, Pierre
Ngayee J Law wrote:> Hi all,
>
> Suppose I have a vector
> Fruits <-
c('Apple','Orange','Pear','Banana','Mango')
>
> I want to print the statement
> "The fruits in the basket are: Apple, Orange, Pear, Banana,
Mango"
>
> If I do:
> print(paste('The fruits in the basket are:',Fruits))
>
> The output is:
> [1] "The fruits in the basket are: Apple" "The fruits in
the basket are:
> Orange"
> [3] "The fruits in the basket are: Pear" "The fruits in
the basket are:
> Banana"
> [5] "The fruits in the basket are: Mango"
>
> Is there any easy ways to solve this problem? Thanks!
>
> - Jackie
>
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
-----------------------------------------------------------------
Pierre Kleiber Email: pkleiber at honlab.nmfs.hawaii.edu
Fishery Biologist Tel: 808 983-5399/737-7544
NOAA FISHERIES - Honolulu Laboratory Fax: 808 983-2902
2570 Dole St., Honolulu, HI 96822-2396
-----------------------------------------------------------------
"God could have told Moses about galaxies and mitochondria and
all. But behold... It was good enough for government work."
-----------------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi. Have you tried this?
paste("The fruits in the basket are:", paste(Fruits, collapse=",
"))
Good luck.
Kevin
-----Original Message-----
From: Ngayee J Law [mailto:Ngayee.Law at celeradiagnostics.com]
Sent: Tuesday, September 10, 2002 5:51 PM
To: r-help at stat.math.ethz.ch
Subject: [R] print
Hi all,
Suppose I have a vector
Fruits <-
c('Apple','Orange','Pear','Banana','Mango')
I want to print the statement
"The fruits in the basket are: Apple, Orange, Pear, Banana, Mango"
If I do:
print(paste('The fruits in the basket are:',Fruits))
The output is:
[1] "The fruits in the basket are: Apple" "The fruits in the
basket are:
Orange"
[3] "The fruits in the basket are: Pear" "The fruits in the
basket are:
Banana"
[5] "The fruits in the basket are: Mango"
Is there any easy ways to solve this problem? Thanks!
- Jackie
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>Suppose I have a vector >Fruits <- c('Apple','Orange','Pear','Banana','Mango') >I want to print the statement >"The fruits in the basket are: Apple, Orange, Pear, Banana, Mango"How about this: cat("The fruits in the basket are: ", paste(Fruits)) Cheers, Pijus ---- W: 212-588-7897 F: 212-446-1955 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._