problem with read.table
4
0
Entering edit mode
carol white ▴ 680
@carol-white-2174
Last seen 9.5 years ago
European Union
Hi, Although I set check.names to FALSE in read.table, the duplicate names get modified. What should be done in this case? the text file to be read by read.table AM2      AM2     AM2     FAL 2               3             4         5 1               -1           -3        -2 t = read.table ("my_file", check.names = F, header = T) > t AM2      AM2.1     AM2.2     FAL 2               3             4         5 1               -1           -3        -2 instead of AM2      AM2     AM2    FAL 2               3             4         5 1               -1           -3        -2 Best, carol [[alternative HTML version deleted]]
• 1.2k views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States
Hi Carol... Carol white <wht_crl at="" yahoo.com=""> writes: > Hi, > Although I set check.names to FALSE in read.table, the duplicate names get modified. What should be done in this case? > > the text file to be read by read.table > > AM2????? AM2???? AM2???? FAL > 2?????????????? 3???????????? 4???????? 5 > 1?????????????? -1?????????? -3??????? -2 > > t = read.table ("my_file", check.names = F, header = T) Maybe spell out TRUE, FALSE (reserved words, cannot be assigned to) to avoid getting the value of variables T, F from your environment?? Martin >> t > AM2????? AM2.1 ??? AM2.2 ??? FAL > > 2?????????????? 3???????????? 4???????? 5 > > 1?????????????? -1?????????? -3??????? -2 > > instead of > > AM2????? AM2 ??? AM2??? FAL > > > 2?????????????? 3???????????? 4???????? 5 > > > 1?????????????? -1?????????? -3??????? -2 > > > Best, > carol > > > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M2 B169 Phone: (206) 667-2793
ADD COMMENT
0
Entering edit mode
t = read.table ("my_file", check.names = FALSE, header = T) gives the same result, modifying duplicate names. Carol --- On Sat, 7/19/08, Martin Morgan <mtmorgan@fhcrc.org> wrote: From: Martin Morgan <mtmorgan@fhcrc.org> Subject: Re: [BioC] problem with read.table To: wht_crl@yahoo.com Cc: bioconductor@stat.math.ethz.ch Date: Saturday, July 19, 2008, 1:52 PM Hi Carol... Carol white <wht_crl@yahoo.com> writes: > Hi, > Although I set check.names to FALSE in read.table, the duplicate names get modified. What should be done in this case? > > the text file to be read by read.table > > AM2 AM2 AM2 FAL > 2 3 4 5 > 1 -1 -3 -2 > > t = read.table ("my_file", check.names = F, header = T) Maybe spell out TRUE, FALSE (reserved words, cannot be assigned to) to avoid getting the value of variables T, F from your environment?? Martin >> t > AM2 AM2.1 AM2.2 FAL > > 2 3 4 5 > > 1 -1 -3 -2 > > instead of > > AM2 AM2 AM2 FAL > > > 2 3 4 5 > > > 1 -1 -3 -2 > > > Best, > carol > > > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M2 B169 Phone: (206) 667-2793 [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Since you do not follow the posting guide and provide sessionInfo (nor identify yourself), there is little anyone can do to help, the problem is almost sure operator error (neither the released nor current devel versions of R gives me the result you are claiming), and if not, it is an R problem, not a bioconductor one and you should be posting there, not here Robert carol white wrote: > t = read.table ("my_file", check.names = FALSE, header = T) > gives the same result, modifying duplicate names. > > Carol > --- On Sat, 7/19/08, Martin Morgan <mtmorgan at="" fhcrc.org=""> wrote: > From: Martin Morgan <mtmorgan at="" fhcrc.org=""> > Subject: Re: [BioC] problem with read.table > To: wht_crl at yahoo.com > Cc: bioconductor at stat.math.ethz.ch > Date: Saturday, July 19, 2008, 1:52 PM > > Hi Carol... > > Carol white <wht_crl at="" yahoo.com=""> writes: > >> Hi, >> Although I set check.names to FALSE in read.table, the duplicate names get > modified. What should be done in this case? >> the text file to be read by read.table >> >> AM2 AM2 AM2 FAL >> 2 3 4 > 5 >> 1 -1 -3 -2 >> >> t = read.table ("my_file", check.names = F, header = T) > > Maybe spell out TRUE, FALSE (reserved words, cannot be assigned to) to > avoid getting the value of variables T, F from your environment?? > > Martin > >>> t >> AM2 AM2.1 AM2.2 FAL >> >> 2 3 4 > 5 >> 1 -1 -3 -2 >> >> instead of >> >> AM2 AM2 AM2 FAL >> >> >> 2 3 4 > 5 >> >> 1 -1 -3 -2 >> >> >> Best, >> carol >> >> >> >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 rgentlem at fhcrc.org
ADD REPLY
0
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States
carol white <wht_crl at="" yahoo.com=""> writes: > > t = read.table ("my_file", check.names = FALSE, header = T) > gives the same result, modifying duplicate names. > Carol what does sessionInfo() say (i.e., is your R current; is this something special to your OS or LOCALE)? Have you done this in a 'clean' R session, e.g., starting R from the shell with R --vanilla ? And for what it's worth > read.table("~/tmp/tmp.txt", header=TRUE, check.names=FALSE) AM2 AM2 AM2 FAL 1 2 3 4 5 2 1 -1 -3 -2 > sessionInfo() R version 2.7.1 Patched (2008-07-03 r46033) x86_64-unknown-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US .UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_N AME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTI FICATION=C attached base packages: [1] stats graphics utils datasets grDevices methods base Martin > --- On Sat, 7/19/08, Martin Morgan <mtmorgan at="" fhcrc.org=""> wrote: > > From: Martin Morgan <mtmorgan at="" fhcrc.org=""> Subject: Re: > [BioC] problem with read.table To: wht_crl at yahoo.com Cc: > bioconductor at stat.math.ethz.ch Date: Saturday, July 19, 2008, > 1:52 PM > > > Hi Carol... > > > Carol white <wht_crl at="" yahoo.com=""> writes: > > > > Hi, > > > Although I set check.names to FALSE in read.table, the duplicate names get > > modified. What should be done in this case? > > > > > > the text file to be read by read.table > > > > > > AM2 AM2 AM2 FAL > > > 2 3 > 4 > > 5 > > > 1 -1 -3 -2 > > > > > > t = read.table ("my_file", check.names = F, header = T) > > > Maybe spell out TRUE, FALSE (reserved words, cannot be assigned to) to > > avoid getting the value of variables T, F from your environment?? > > > Martin > > > >> t > > > AM2 AM2.1 AM2.2 FAL > > > > > > 2 3 4 > > 5 > > > > > > 1 -1 -3 -2 > > > > > > instead of > > > > > > AM2 AM2 AM2 FAL > > > > > > > > > 2 3 4 > > 5 > > > > > > > > > 1 -1 -3 -2 > > > > > > > > > Best, > > > carol > > > > > > > > > > > > > > > [[alternative HTML version deleted]] > > > > > > _______________________________________________ > > > Bioconductor mailing list > > > Bioconductor at stat.math.ethz.ch > > > > https://stat.ethz.ch/mailman/listinfo/bioconductor > > > Search the archives: > > http://news.gmane.org/gmane.science.biology.informatics.conductor > > > -- > > Martin Morgan > > Computational Biology / Fred Hutchinson Cancer Research Center > > 1100 Fairview Ave. N. > > PO Box 19024 Seattle, WA 98109 > > > Location: Arnold Building M2 B169 > > Phone: (206) 667-2793 > > > -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M2 B169 Phone: (206) 667-2793
ADD COMMENT
0
Entering edit mode
Lynn Amon ▴ 280
@lynn-amon-2429
Last seen 10.2 years ago
Hi Carol, I've had trouble with read.table also. It doesn't always read all the rows and columns. I recommend using read.csv(sep="\t") instead. Lynn Amon Martin Morgan wrote: > carol white <wht_crl at="" yahoo.com=""> writes: > > >> >> t = read.table ("my_file", check.names = FALSE, header = T) >> gives the same result, modifying duplicate names. >> Carol >> > > what does sessionInfo() say (i.e., is your R current; is this > something special to your OS or LOCALE)? Have you done this in a > 'clean' R session, e.g., starting R from the shell with R --vanilla ? > And for what it's worth > > >> read.table("~/tmp/tmp.txt", header=TRUE, check.names=FALSE) >> > AM2 AM2 AM2 FAL > 1 2 3 4 5 > 2 1 -1 -3 -2 > > >> sessionInfo() >> > R version 2.7.1 Patched (2008-07-03 r46033) > x86_64-unknown-linux-gnu > > locale: > LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_ US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC _NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDEN TIFICATION=C > > attached base packages: > [1] stats graphics utils datasets grDevices methods base > > Martin > > >> --- On Sat, 7/19/08, Martin Morgan <mtmorgan at="" fhcrc.org=""> wrote: >> >> From: Martin Morgan <mtmorgan at="" fhcrc.org=""> Subject: Re: >> [BioC] problem with read.table To: wht_crl at yahoo.com Cc: >> bioconductor at stat.math.ethz.ch Date: Saturday, July 19, 2008, >> 1:52 PM >> >> >> Hi Carol... >> >> >> Carol white <wht_crl at="" yahoo.com=""> writes: >> >> >> > Hi, >> >> > Although I set check.names to FALSE in read.table, the duplicate names get >> >> modified. What should be done in this case? >> >> > >> >> > the text file to be read by read.table >> >> > >> >> > AM2 AM2 AM2 FAL >> >> > 2 3 >> 4 >> >> 5 >> >> > 1 -1 -3 -2 >> >> > >> >> > t = read.table ("my_file", check.names = F, header = T) >> >> >> Maybe spell out TRUE, FALSE (reserved words, cannot be assigned to) to >> >> avoid getting the value of variables T, F from your environment?? >> >> >> Martin >> >> >> >> t >> >> > AM2 AM2.1 AM2.2 FAL >> >> > >> >> > 2 3 4 >> >> 5 >> >> > >> >> > 1 -1 -3 -2 >> >> > >> >> > instead of >> >> > >> >> > AM2 AM2 AM2 FAL >> >> > >> >> > >> >> > 2 3 4 >> >> 5 >> >> > >> >> > >> >> > 1 -1 -3 -2 >> >> > >> >> > >> >> > Best, >> >> > carol >> >> > >> >> > >> >> > >> >> > >> >> > [[alternative HTML version deleted]] >> >> > >> >> > _______________________________________________ >> >> > Bioconductor mailing list >> >> > Bioconductor at stat.math.ethz.ch >> >> > >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> >> > Search the archives: >> >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> >> -- >> >> Martin Morgan >> >> Computational Biology / Fred Hutchinson Cancer Research Center >> >> 1100 Fairview Ave. N. >> >> PO Box 19024 Seattle, WA 98109 >> >> >> Location: Arnold Building M2 B169 >> >> Phone: (206) 667-2793 >> >> >> >> > >
ADD COMMENT
0
Entering edit mode
This does not make a whole lot of sense, since read.csv is a wrapper around read.table: > read.csv function (file, header = TRUE, sep = ",", quote = "\"", dec = ".", fill = TRUE, comment.char = "", ...) read.table(file = file, header = header, sep = sep, quote = quote, dec = dec, fill = fill, comment.char = comment.char, ...) <environment: namespace:utils=""> Notice the fill = TRUE argument, that is sometimes nice and sometimes catastrophic, depending on what file you are reading. Kasper On Jul 20, 2008, at 1:55 PM, Lynn Amon wrote: > Hi Carol, > I've had trouble with read.table also. It doesn't always read all > the rows and columns. I recommend using read.csv(sep="\t") instead. > Lynn Amon > > > Martin Morgan wrote: >> carol white <wht_crl at="" yahoo.com=""> writes: >> >> >>> t >>> = read.table ("my_file", check.names = FALSE, header = >>> T) gives the same result, modifying duplicate >>> names. Carol >> >> what does sessionInfo() say (i.e., is your R current; is this >> something special to your OS or LOCALE)? Have you done this in a >> 'clean' R session, e.g., starting R from the shell with R --vanilla ? >> And for what it's worth >> >> >>> read.table("~/tmp/tmp.txt", header=TRUE, check.names=FALSE) >>> >> AM2 AM2 AM2 FAL >> 1 2 3 4 5 >> 2 1 -1 -3 -2 >> >> >>> sessionInfo() >>> >> R version 2.7.1 Patched (2008-07-03 r46033) x86_64-unknown-linux- gnu >> locale: >> LC_CTYPE >> = >> en_US >> .UTF >> -8 >> ;LC_NUMERIC >> = >> C >> ;LC_TIME >> = >> en_US >> .UTF >> -8 >> ;LC_COLLATE >> = >> en_US >> .UTF >> -8 >> ;LC_MONETARY >> = >> C >> ;LC_MESSAGES >> = >> en_US >> .UTF >> -8 >> ;LC_PAPER >> = >> en_US >> .UTF >> -8 >> ;LC_NAME >> = >> C >> ;LC_ADDRESS >> =C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C >> >> attached base packages: >> [1] stats graphics utils datasets grDevices methods >> base Martin >> >> >>> --- On Sat, 7/19/08, Martin Morgan <mtmorgan at="" fhcrc.org=""> >>> wrote >>> : From >>> : Martin Morgan <mtmorgan at="" fhcrc.org=""> Subject: >>> Re: [BioC] problem with read.table To: wht_crl at yahoo.com >>> Cc: bioconductor at stat.math.ethz.ch Date: >>> Saturday, July 19, 2008, 1:52 >>> PM >>> Hi >>> >>> Carol >>> ... Carol >>> white <wht_crl at="" yahoo.com=""> >>> writes >>> : > >>> >>> Hi >>> , > >>> Although I set check.names to FALSE in read.table, the duplicate >>> names >>> get >>> modified >>> . What should be done in this >>> case >>> ? > >>> > >>> the text file to be read by >>> read >>> .table >>> > >>> > >>> AM2 AM2 AM2 >>> FAL >>> > >>> 2 >>> 3 >>> 4 >>> 5 >>> > >>> 1 -1 -3 >>> -2 >>> > >>> > >>> t = read.table ("my_file", check.names = F, header = >>> T >>> ) Maybe >>> spell out TRUE, FALSE (reserved words, cannot be assigned to) >>> to >>> avoid >>> getting the value of variables T, F from your >>> environment >>> ?? Martin >>> > >>> > >>> t >>> > >>> AM2 AM2.1 AM2.2 >>> FAL >>> > >>> > >>> 2 3 >>> 4 >>> 5 >>> > >>> > >>> 1 -1 -3 >>> -2 >>> > >>> > >>> instead >>> of >>> > >>> > >>> AM2 AM2 AM2 >>> FAL >>> > >>> > >>> > >>> 2 3 >>> 4 >>> 5 >>> > >>> > >>> > >>> 1 -1 -3 >>> -2 >>> > >>> > >>> > >>> >>> Best >>> , > >>> >>> carol >>> > >>> > >>> > >>> > >>> > >>> [[alternative HTML version >>> deleted >>> ]] > >>> > >>> >>> _______________________________________________ >>> > >>> Bioconductor mailing >>> list >>> > >>> >>> Bioconductor >>> @stat >>> .math >>> .ethz >>> .ch >>> > >>> https >>> ://stat.ethz.ch/mailman/listinfo/ >>> bioconductor >>> > >>> Search the >>> archives >>> : http >>> ://news.gmane.org/ >>> gmane >>> .science >>> .biology >>> .informatics >>> .conductor >>> -- Martin >>> >>> Morgan >>> Computational >>> Biology / Fred Hutchinson Cancer Research >>> Center >>> 1100 >>> Fairview Ave. >>> N >>> . PO >>> Box 19024 Seattle, WA >>> 98109 >>> Location >>> : Arnold Building M2 >>> B169 >>> Phone >>> : (206) 667-2793 >>> >>> >> >> > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY
0
Entering edit mode
@herve-pages-1542
Last seen 3 hours ago
Seattle, WA, United States
Hi carol, Since this is not a Bioconductor specific issue, you could also try to ask on the R-help list where you'll get a broader audience. Cheers, H. carol white wrote: > Hi, > Although I set check.names to FALSE in read.table, the duplicate names get modified. What should be done in this case? > > the text file to be read by read.table > > AM2 AM2 AM2 FAL > 2 3 4 5 > 1 -1 -3 -2 > > t = read.table ("my_file", check.names = F, header = T) > >> t > AM2 AM2.1 AM2.2 FAL > > 2 3 4 5 > > 1 -1 -3 -2 > > instead of > > AM2 AM2 AM2 FAL > > > 2 3 4 5 > > > 1 -1 -3 -2 > > > Best, > carol > > > > > [[alternative HTML version deleted]] > > > > -------------------------------------------------------------------- ---- > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT

Login before adding your answer.

Traffic: 561 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