Dear R-guRus: I have 2 questions 1) I have 2 variables, e.g. x<-5; y<-"Char" How do I create a new variable which would have both these values in a string (e.g. "5Char", or "5 Char", etc ) ?? 2) if i have an array x[1:100], and I do x[x==345.123], how do I get position j in the array of those x[j] which are equal to 345.123 ? Thank you very much, Vlad. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
1) paste(x,y)
2) see the function 'which'. However the exact equality test
('==') is
not appropriate here: you need to test for near equality.
Giovanni
> From: VBMorozov at lbl.gov
> Date: Wed, 26 Jun 2002 10:49:06 -0400
> Content-Language: en
> X-Accept-Language: en
> Content-Disposition: inline
> Sender: owner-r-help at stat.math.ethz.ch
> Precedence: SfS-bulk
> Content-Type: text/plain; charset=us-ascii
> Content-Length: 711
>
> Dear R-guRus:
> I have 2 questions
>
> 1) I have 2 variables, e.g. x<-5; y<-"Char"
> How do I create a new variable which would have both these values in a
> string (e.g. "5Char", or "5 Char", etc ) ??
>
> 2) if i have an array x[1:100], and I do x[x==345.123], how do I get
> position j in the array of those x[j] which are equal to 345.123 ?
>
> Thank you very much,
> Vlad.
>
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
__________________________________________________
[ ]
[ Giovanni Petris GPetris at uark.edu ]
[ Department of Mathematical Sciences ]
[ University of Arkansas - Fayetteville, AR 72701 ]
[ Ph: (479) 575-6324, 575-8630 (fax) ]
[ http://definetti.uark.edu/~gpetris/ ]
[__________________________________________________]
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 26 Jun 2002 VBMorozov at lbl.gov wrote:> Dear R-guRus: > I have 2 questions > > 1) I have 2 variables, e.g. x<-5; y<-"Char" > How do I create a new variable which would have both these values in a > string (e.g. "5Char", or "5 Char", etc ) ??cat(x,y) ---------------------------------------------------------------------- Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill clists at perrin.socsci.unc.edu * andrew_perrin (at) unc.edu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear Vlad, On Wed, 26 Jun 2002 VBMorozov at lbl.gov wrote:> 1) I have 2 variables, e.g. x<-5; y<-"Char" > How do I create a new variable which would have both these values in a > string (e.g. "5Char", or "5 Char", etc ) ?? >You can use paste to get both of these results: > x<-5; y<-"Char" > paste(x, y) [1] "5 Char" > paste(x, y, sep="") [1] "5Char" John -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._