[R] Use quotes on a FOR LOOP R

michaelyb cel81009759 at gmail.com
Tue Apr 24 20:29:35 CEST 2012


Hello All!

I need some help to get a FOR LOOP to print the interactor with the
quotation mark.

Let me be more specific:

I have the following:
cbind("Michael","Dana","Rob")->LIST

outcome: 
     [,1]      [,2]   [,3] 
[1,] "Michael" "Dana" "Rob"

UNFORTUNATELY, I need to do the following:
as.data.frame.list(LIST)->LIST2
rm(LIST)

outcome:
  X.Michael. X.Dana. X.Rob.
1    Michael    Dana    Rob

My problem:
I tried the following LOOP:
for (n in LIST2)print((paste("\'",n,"\'"))

outcome:
[1] "*'* Michael *'*"
[1] "*'* Dana*'*"
[1] "*'* Rob*'*"

How can I get the following instead:
[1] "Michael"
[1] "Dana"
[1] "Rob"

Detail: I cannot use the first LIST to do the FOR LOOP since I need to
remove it first.
Any help, please?

Thank you!

--
View this message in context: http://r.789695.n4.nabble.com/Use-quotes-on-a-FOR-LOOP-R-tp4584438p4584438.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list