Limiting the decimals of intensity from SNP array in R
1
0
Entering edit mode
10.2 years ago
viniciushs88 ▴ 50

I would like to limit the number of decimals of SNP array signal when a data frame is imported. My .txt input have 16 decimals to each row in collumn "Value". In a same collumns it can have numbers and strings (Non called intensities = NC), at same time. My dataframe look like that:

Value
0.202021561664556
0.202021561664556
0.202021561664556
0.202021561664556
NC
...

My expected dataframe

Value
0.20202156
0.20202156
0.20202156
0.20202156
NC
...

Real input (DF) that not works:

DF <- "NE001358.Log.R.Ratio
    -0.0970369274475688
    0.131893549586039
    0.0629266495860389
    0.299559132381831
    -0.0128804337656807
    0.0639743960526874
    0.0271669351886552
    0.322395363972391
    0.179591292893632
            NC"

DF <- read.table(text=DF, header = TRUE)
string decimals R intensity numbers • 1.9k views
ADD COMMENT
0
Entering edit mode

Take a look at ?round

ADD REPLY
0
Entering edit mode
and to tell NC means a missing data point use df <- read.table(..., na.strings="NC")
ADD REPLY
0
Entering edit mode
10.2 years ago

Just use round(x,8), where x is the column in question.

ADD COMMENT

Login before adding your answer.

Traffic: 3688 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6