Le lundi 14 avril 2014 à 08:50 -0700, Jeff Newmiller a écrit : > You have not posted the input to your code so it is not reproducible. > Also, you have posted in HTML, which is notorious for corrupting R > code and data in emails. > > If I were to guess, though, it looks to me like you are working with a > UTF-8 file with a Byte Order Mark (header). I don't know the "correct" > way to address this, but if you only have plain text data then the > rest of your table should be valid and you could reset the name of the > first column yourself like > > names(sim)[1] <- "X" If the byte order mark is the problem, then the natural way of handling this is to pass fileEncoding="UTF-8-BOM" to read.table().
Regards > --------------------------------------------------------------------------- > Jeff Newmiller The ..... ..... Go Live... > DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/Batteries O.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --------------------------------------------------------------------------- > Sent from my phone. Please excuse my brevity. > > On April 14, 2014 7:52:11 AM PDT, Pavneet Arora > <pavneet.ar...@uk.rsagroup.com> wrote: > >Hey All > > > >I am trying to read in a small text file using read.table. > > > >dput(sim) > >structure(list(��...X. = 1:7, Y1 = c(2.5501, 4.105, 5.4687, 7.0009, > >8.5066, 9.785, 11.5167), Y2 = c(2.5501, 4.105, 5.4687, 11.0009, > >8.5066, 9.785, 11.5167), Y3 = c(2.5501, 4.105, 5.4687, 7.0009, > >8.5066, 9.785, 15.5167)), .Names = c("��...X.", "Y1", "Y2", "Y3" > >), class = "data.frame", row.names = c(NA, -7L)) > > > >But for some reason my first header comes as "?...X. ", instead of just > > > >"X". Can some one please tell me why? And how to fix it? > > > >This is what I did in my code, using R-studio > >> sim<-read.table("C:/00Pavneet/# MSc/# temp/sim data 1.txt",header=T) > >> View(sim) > > > > > >*********************************************************************************************************************************************************************************************************************** > >MORE TH>N is a trading style of Royal & Sun Alliance Insurance plc (No. > >93792). Registered in England and Wales at St. Mark���s Court, Chart > >Way, Horsham, West Sussex, RH12 1XL. > > > >Authorised by the Prudential Regulation Authority and regulated by the > >Financial Conduct Authority and the Prudential Regulation Authority. > >************************************************************************************************************************************************************************************************************************ > > > > [[alternative HTML version deleted]] > > > > > > > >------------------------------------------------------------------------ > > > >______________________________________________ > >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. > > ______________________________________________ > 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. ______________________________________________ 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.