Hi,
You seem to have a glitch in one file,
testread12=read.table("Test100.txt", head = T)
str(testread12) # Column131 is converted to a factor
# $ Column131: Factor w/ 2920 levels "--","-0.000122393",..
combining the second data set with this one will convert the new data
into factor for this column but some (most) levels were not present in
the first file.
HTH,
baptiste
gug wrote:
Hello,
I have been using a very simple rbind approach (simple enough for me to
understand) to combine data files within R.
It seems to work fine, but then generates warning messages for reasons that
I can't begin to understand. The text below shows the issue.
testread12=read.table("C:/Files/Test100.txt", head = T)
testread11=read.table("C:/Files/Test101.txt", head = T)
testbind1=rbind(testread12,testread11)
testbind2=rbind(testread11,testread12)
The testrbind1 line generates the following message:
"Warning message:
In `[<-.factor`(`*tmp*`, ri, value = c(0.00557998, -0.058016069, :
invalid factor level, NAs generated"
However the testrbind2 line works fine. Although the data in the files is
different, the format (columns, etc) should be identical. The fact that it
works in one order, but not the other, makes it very difficult for me to
understand what the problem is.
Files attached. Any suggestions gratefully received. Thanks,
Guy Green
http://www.nabble.com/file/p24130996/Test101.txt Test101.txt
http://www.nabble.com/file/p24130996/Test100.txt Test100.txt
--
_____________________________
Baptiste AuguiƩ
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.