[R] Adding a decimal point at the second mark in R

Rolf Turner r.turner at auckland.ac.nz
Sat Oct 3 01:21:40 CEST 2015


On 03/10/15 05:26, Jon1985 wrote:

> Using R, I have two columns (onset, duration) containing milliseconds in a
> data frame. I want to add a decimal point at the second mark for all data
> points in both columns i.e. turning 1541ms into 1.541s AND turning 638ms
> into 0.638s.
>
> Could someone tell me how to do this?

How about

    X$onset    <- X$onset/1000
    X$duration <- X$duration/1000

???

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list