Ernesto Jardim wrote: > I want to use the first digit of the elements of a vector. > > I've tried grep but didn't work. > > Any help is welcome. substr(as.character(runif(100,0,2)), 1, 1) see ?substr -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894