2016-06-19 3 views
0

Я пытаюсь объединить столбцы из нескольких файлов, но я получаю сообщение об ошибке, которое влияет на слияние некоторых моих файлов. Я не уверен, где происходит ошибка, любая идея?Объединение столбцов из нескольких файлов

file_list <- list.files(pattern = "*.mirna") 

library(data.table) 
lst <- lapply(file_list, function(x) 
    fread(x, select=c("mir", "seq", "freq","mism","add","t5","t3"))[, 
                    list(ID=paste(mir, seq, mism,add,t5,t3), freq=freq)]) 
miraligner <- as.data.frame(Reduce(function(x,y) x[y, on = "ID"], lst)) 
head(miraligner) 
Warning messages: 
1: In fread(x, select = c("mir", "seq", "freq", "mism", "add", "t5", : 
    Bumped column 9 to type character on data row 6, field contains 'g'. Coercing 
    previously read values in this column from logical, integer or numeric back to 
    character which may not be lossless; e.g., if '00' and '000' occurred before they 
    will now be just '0', and there may be inconsistencies with treatment of ',,' and 
    ',NA,' too (if they occurred in this column before the bump). If this matters please 
    rerun and set 'colClasses' to 'character' for this column. Please note that column 
    type detection uses the first 5 rows, the middle 5 rows and the last 5 rows, so 
    hopefully this message should be very rare. If reporting to datatable-help, please 
    rerun and include the output from verbose=TRUE. 
2: In fread(x, select = c("mir", "seq", "freq", "mism", "add", "t5", : 

Bumped column 9 to type character on data row 16, field contains 't'. Coercing 
    previously read values in this column from logical, integer or numeric back to 
    character which may not be lossless; e.g., if '00' and '000' occurred before they 
    will now be just '0', and there may be inconsistencies with treatment of ',,' and 
    ',NA,' too (if they occurred in this column before the bump). If this matters please 
    rerun and set 'colClasses' to 'character' for this column. Please note that column 
    type detection uses the first 5 rows, the middle 5 rows and the last 5 rows, so 
    hopefully this message should be very rare. If reporting to datatable-help, please 
    rerun and include the output from verbose=TRUE. 

Мои файлы выглядеть следующим образом:

> head(Xfile) 
          seq   name freq    mir start end mism add t5 t3  s5  s3 DB  precursor ambiguity 
1  AACTGGTTGAACAACTGAACC seq_100018_x3 3 hsa-miR-582-3p 54 74 0  0 t 0 ATTGTAAC AACCCAAA miRNA hsa-mir-582   1 
2  TAGCACCATTTGAAATCAGTGT seq_10002_x43 43 hsa-miR-29b-3p 52 73 0  0 0 t TATCTAGC TGTTTTAG miRNA hsa-mir-29b-2   1 
3 TGAGTGTGTGTGTGTGAGTGTGTGTTTT seq_100046_x3 3 hsa-miR-574-5p 25 49 0 I-TTT 0 GT CGTGTGAG GTGTGTCG miRNA hsa-mir-574   1 
4  GTCATACACGGCTCTCCTCTC seq_100072_x3 3 hsa-miR-485-3p 46 66 0  0 0 t GCGAGTCA CTCTTTTA miRNA hsa-mir-485   1 
5  CTGGACTTGGAGTCAGAAGGCAC seq_100077_x3 3 hsa-miR-378a-3p 44 64 0 I-AC a 0 TAGCACTG AGGCCT miRNA hsa-mir-378a   1 
6  TAACACTGTCTGGTAACGATGGT seq_100080_x3 3 hsa-miR-200a-3p 54 74 0 I-GT 0 t ACTCTAAC ATGTTCAA miRNA hsa-mir-200a   1 

ответ

1

Вы не должны заботиться об этом.

Ваш 9-й столбец (t5) содержит 0 или буквы. fread пытается автоматизировать тип переменной на основе нескольких записей (5).

Для тех файлов, в которых 5 первых записей содержат только 0, это автоопределение как числовое. Например, когда он встречает «t» или «a», он переключается на charaters, будучи достаточно интересным, чтобы сообщить вам.

+0

Нет, fread не может объединить файлы, когда имеется больше определенного количества файлов. – user2300940

Смежные вопросы