Dear all members I have error with the following code #Input data set thd <- as.matrix(read.table("C:/Users/hp/Desktop/thd.txt")) #Input data set data<-list(N1=2000,N2=2000,P=9,R=Ro,z1=yo1,z2=yo2,thd) and the the matrix -200.000 -2.517 -1.245 -0.444 0.848 200.000 -200.000 -1.447 -0.420 0.119 1.245 200.000 -200.000 -1.671 -0.869 -0.194 0.679 200.000 -200.000 -1.642 -0.869 -0.293 0.332 200.000 -200.000 -1.671 -0.827 0.052 0.756 200.000 thd matrix saved as a text file, i have the following errors In read.table("C:/Users/hp/Desktop/thd.txt") : incomplete final line found by readTableHeader on 'C:/Users/hp/Desktop/thd.txt' The thd matrix didn't appear in the results, so i hope anyone can help me to solve this problem. Many thanks in advance -- Thanoon Y. Thanoon PhD Candidate Department of Mathematical Sciences Faculty of Science University Technology Malaysia, UTM E.Mail: Thanoon.younis80 at gmail.com E.Mail: dawn_prayer80 at yahoo.com Facebook:Thanoon Younis AL-Shakerchy Twitter: Thanoon Alshakerchy H.P:00601127550205 [[alternative HTML version deleted]]
Works fine for me. The error message just means that the last line did not end with a 'new line' character:> x <- as.matrix(read.table("/temp/td.txt"))Warning message: In read.table("/temp/td.txt") : incomplete final line found by readTableHeader on '/temp/td.txt'> data<-list(N1=2000,N2=2000,P=9,x) > > data$N1 [1] 2000 $N2 [1] 2000 $P [1] 9 [[4]] V1 V2 V3 V4 V5 V6 [1,] -200 -2.517 -1.245 -0.444 0.848 200 [2,] -200 -1.447 -0.420 0.119 1.245 200 [3,] -200 -1.671 -0.869 -0.194 0.679 200 [4,] -200 -1.642 -0.869 -0.293 0.332 200 [5,] -200 -1.671 -0.827 0.052 0.756 200 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Mar 18, 2015 at 1:12 PM, thanoon younis <thanoon.younis80 at gmail.com> wrote:> Dear all members > > I have error with the following code > > #Input data set > thd <- as.matrix(read.table("C:/Users/hp/Desktop/thd.txt")) > > #Input data set > data<-list(N1=2000,N2=2000,P=9,R=Ro,z1=yo1,z2=yo2,thd) > > and the the matrix > > -200.000 -2.517 -1.245 -0.444 0.848 200.000 > -200.000 -1.447 -0.420 0.119 1.245 200.000 > -200.000 -1.671 -0.869 -0.194 0.679 200.000 > -200.000 -1.642 -0.869 -0.293 0.332 200.000 > -200.000 -1.671 -0.827 0.052 0.756 200.000 > > thd matrix saved as a text file, i have the following errors > > In read.table("C:/Users/hp/Desktop/thd.txt") : > incomplete final line found by readTableHeader on > 'C:/Users/hp/Desktop/thd.txt' > > The thd matrix didn't appear in the results, so i hope anyone can help me > to solve this problem. > > Many thanks in advance > > -- > Thanoon Y. Thanoon > PhD Candidate > Department of Mathematical Sciences > Faculty of Science > University Technology Malaysia, UTM > E.Mail: Thanoon.younis80 at gmail.com > E.Mail: dawn_prayer80 at yahoo.com > Facebook:Thanoon Younis AL-Shakerchy > Twitter: Thanoon Alshakerchy > H.P:00601127550205 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]
I don't think there is any way we can help with a data set that appears to be sitting on your hard drive. On a wild guess, however, there probaby is a problem with the final line terminator. Open the file in a text editor, go to the last item in the file, place the cursor after it, hit return and save the file. We might be able to help if we had the file. Otherwise please read https://github.com/hadley/devtools/wiki/Reproducibility and/ or http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Otherwise please read John Kane Kingston ON Canada> -----Original Message----- > From: thanoon.younis80 at gmail.com > Sent: Wed, 18 Mar 2015 20:12:53 +0300 > To: r-help at r-project.org > Subject: [R] r help > > Dear all members > > I have error with the following code > > #Input data set > thd <- as.matrix(read.table("C:/Users/hp/Desktop/thd.txt")) > > #Input data set > data<-list(N1=2000,N2=2000,P=9,R=Ro,z1=yo1,z2=yo2,thd) > > and the the matrix > > -200.000 -2.517 -1.245 -0.444 0.848 200.000 > -200.000 -1.447 -0.420 0.119 1.245 200.000 > -200.000 -1.671 -0.869 -0.194 0.679 200.000 > -200.000 -1.642 -0.869 -0.293 0.332 200.000 > -200.000 -1.671 -0.827 0.052 0.756 200.000 > > thd matrix saved as a text file, i have the following errors > > In read.table("C:/Users/hp/Desktop/thd.txt") : > incomplete final line found by readTableHeader on > 'C:/Users/hp/Desktop/thd.txt' > > The thd matrix didn't appear in the results, so i hope anyone can help me > to solve this problem. > > Many thanks in advance > > -- > Thanoon Y. Thanoon > PhD Candidate > Department of Mathematical Sciences > Faculty of Science > University Technology Malaysia, UTM > E.Mail: Thanoon.younis80 at gmail.com > E.Mail: dawn_prayer80 at yahoo.com > Facebook:Thanoon Younis AL-Shakerchy > Twitter: Thanoon Alshakerchy > H.P:00601127550205 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more!