Re: [R] Left/right hand side characters

From: Gabor Csardi <csardi_at_rmki.kfki.hu>
Date: Mon, 14 May 2007 19:04:46 +0200

See ?substr.

Gabor

On Mon, May 14, 2007 at 05:49:25PM +0100, Brooks, Anthony B wrote:
> Hello all
>
> Is there a way reducing the number of characters in a list so that just
> the left n numbers of characters is given?
>
> For example, If I have a list, listnames, which consists of 4 strings of
> 6 characters;
>
>
>
> >listnames
>
> [1] "item12" "item34" "item56" "item78"
>
>
>
> Is there a way to reduce this so only the 5 characters on the lefthand
> side are given (similar to the LEFT function in Excel)
>
>
>
> So that I'd get a list like this
>
>
>
> >listnames
>
> [1] "item1" "item3" "item5" "item7"
>
>
>
> Thanks
>
> Tony
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch 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.

-- 
Csardi Gabor <csardi_at_rmki.kfki.hu>    MTA RMKI, ELTE TTK

______________________________________________
R-help_at_stat.math.ethz.ch 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.
Received on Mon 14 May 2007 - 17:12:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 May 2007 - 17:31:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.