Another newbie question.... I want to create a factor (say cT)from a numerical variable (sy temp) by regrouping the values in classes (say cT <390, [390,400[,[400,409[...>=550) Is there a simple way of doing that using the factor function? AND I do not find how to manipulate strings (I want to concatenete characters strings ("abkdas","chjw") into something like ("abkdas;chjw")what operators are available for strings manipulation and where do I find help?? Thanks a lot to you all Anne Anne Piotet av Jomini 1 1004 lausanne t?l: +41 21 646 41 32
On Fri, 12 Sep 2003 anne.piotet at urbanet.ch wrote:> Another newbie question.... > I want to create a factor (say cT)from a numerical variable (sy temp) by > regrouping the values in classes (say cT <390, [390,400[,[400,409[...>=550) > > Is there a simple way of doing that using the factor function?No, but see ?cut.> AND I do not find how to manipulate strings (I want to concatenete characters > strings ("abkdas","chjw") into something like ("abkdas;chjw")what operators are > available for strings manipulation and where do I find help??See ?paste. This is in `An Introduction to R', and all good books on S/R will give you more details. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
anne.piotet at urbanet.ch wrote:> I do not find how to manipulate strings (I want to concatenete characters > strings ("abkdas","chjw") into something like ("abkdas;chjw")what operators are > available for strings manipulation and where do I find help??Use the paste operator with specification of separator : e.g. paste("abkdas","chjw",sep=";") will return string "abkdas;chjw" Laurent
In a message dated 9/12/03 1:16:51 AM Pacific Daylight Time, ripley@stats.ox.ac.uk writes:> On Fri, 12 Sep 2003 anne.piotet@urbanet.ch wrote: > > >Another newbie question.... > > I want to create a factor (say cT)from a numerical variable (sy temp) by > >regrouping the values in classes (say cT <390, [390,400[,[400,409[...>=550) > > > >Is there a simple way of doing that using the factor function? > > No, but see ?cut.Also see, cut2 in "design" library. There are other useful functions for data manipulation and management. Documentation can be found at: <A HREF="http://hesweb1.med.virginia.edu/biostat/s/Design.html">http://hesweb1.med.virginia.edu/biostat/s/Design.html</A> [[alternative HTML version deleted]]