You can use substring
on character vectors to cut them down. Here we take only the first ten characters in the string.
> DF
## Value
## 1 0.202021561664556
## 2 0.202021561664556
## 3 0.202021561664556
## 4 0.202021561664556
## 5 NC
> DF$Value <- substring(DF$Value, 1, 10)
> DF
## Value
## 1 0.20202156
## 2 0.20202156
## 3 0.20202156
## 4 0.20202156
## 5 NC
But since these are log ratios, they should really be numeric. In your DF data at the bottom of your post, you could wrap substring
in as.numeric
and NA
values will replace "NC" entries.
> DF[,1] <- as.numeric(substring(DF[,1], 1, 10))