HI R lovers, I have been facing a petty trouble with datas' import : I have a plain txt file (see attached file or the copy below) that I cannot read either with scan or read.table> scan(file="F:/Alt/HDG/Stoliaroff/Data/test.txt")Error in scan(file = "F:/Alt/HDG/Stoliaroff/Data/test.txt") : "scan" expected a real, got "??6"> read.table(file="F:/Alt/HDG/Stoliaroff/Data/test.txt")V1 1 ??6 2 \n 3 6 4 4 5 5 6 3 7 3 8 \n 9 6 10 4 11 5 12 3 13 3 14 \n 15 6 16 4 17 5 18 3 19 2 20 \n 21 6 22 4 23 5 24 3 25 2 26 \n 27 My file is as simple as: 62.5000 47.5048 56.8500 36.4700 32.4500 62.1500 47.0952 55.0500 35.5600 30.1500 61.3300 45.2476 53.6500 34.8200 29.4900 61.6600 46.2286 53.8500 35.2000 30.6400 62.0000 47.3714 54.4400 35.1100 30.1600 60.8500 46.7143 52.9900 34.4200 29.3400 61.0900 46.4381 52.7600 33.9600 29.1000 <<test.txt>> Does anybody have an idea of the cause of my problem? Besides, I'd like to know if there is a function for importing datas from excel file? I cannot find one... Thanks a lot for any help Sorry for my poor english and the possible irrelevancy of my questions Vincent ************************************************************************* Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. SG Asset Management et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. D?couvrez l'offre et les services de SG Asset Management sur le site www.sgam.fr ******** This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither SG Asset Management nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. ************************************************************************* -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test.txt Url: https://stat.ethz.ch/pipermail/r-help/attachments/20031106/f39ae182/test.txt
I am sorry for polluting the list.... I have solved my problem: the text file was written in unicode format.> -----Message d'origine----- > De : STOLIAROFF VINCENT > Envoy? : jeudi 6 novembre 2003 12:04 > ? : 'r-help at stat.math.ethz.ch' > Objet : import data troubles > > HI R lovers, > > I have been facing a petty trouble with datas' import : > > I have a plain txt file (see attached file or the copy below) that I > cannot read either with scan or read.table > > > > scan(file="F:/Alt/HDG/Stoliaroff/Data/test.txt") > Error in scan(file = "F:/Alt/HDG/Stoliaroff/Data/test.txt") : > "scan" expected a real, got "??6" > > > read.table(file="F:/Alt/HDG/Stoliaroff/Data/test.txt") > V1 > 1 ??6 > 2 \n > 3 6 > 4 4 > 5 5 > 6 3 > 7 3 > 8 \n > 9 6 > 10 4 > 11 5 > 12 3 > 13 3 > 14 \n > 15 6 > 16 4 > 17 5 > 18 3 > 19 2 > 20 \n > 21 6 > 22 4 > 23 5 > 24 3 > 25 2 > 26 \n > 27 > > > > My file is as simple as: > > 62.5000 47.5048 56.8500 36.4700 32.4500 > 62.1500 47.0952 55.0500 35.5600 30.1500 > 61.3300 45.2476 53.6500 34.8200 29.4900 > 61.6600 46.2286 53.8500 35.2000 30.6400 > 62.0000 47.3714 54.4400 35.1100 30.1600 > 60.8500 46.7143 52.9900 34.4200 29.3400 > 61.0900 46.4381 52.7600 33.9600 29.1000 > > > << Fichier: test.txt>> > > Does anybody have an idea of the cause of my problem? > > Besides, I'd like to know if there is a function for importing datas from > excel file? I cannot find one... > > Thanks a lot for any help > Sorry for my poor english and the possible irrelevancy of my questions > > Vincent > > >************************************************************************* Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. SG Asset Management et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. D?couvrez l'offre et les services de SG Asset Management sur le site www.sgam.fr ******** This message and any attachments (the "message") are confide...{{dropped}}
--- On Thu 11/06, STOLIAROFF VINCENT < VINCENT.STOLIAROFF at sgam.com > wrote:> I'd like to know if there is a function for importing datas from > excel file?There are a number of choices: - select range in Excel, press ctrl-c and read in the data from the clipboard using read.table("clipboard",header=T) - write out the data from Excel into a .csv file and use read.csv - use Baird's dataload utility (search Google) and convert the .xls file to .rda format and then use the R load command. You can alternately use dataload to convert the xls file to csv or text and then proceed as above. - use the RODBC package to directly read the .xls file. - use the RDCOM package. Its not in CRAN so search for it. This also directly reads the .xls file. _______________________________________________ No banners. No pop-ups. No kidding. Introducing My Way - http://www.myway.com
--- On Thu 11/06, STOLIAROFF VINCENT < VINCENT.STOLIAROFF at sgam.com > wrote:> I'd like to know if there is a function for importing datas from > excel file?There are a number of choices: - select range in Excel, press ctrl-c and read in the data from the clipboard using read.table("clipboard",header=T) - write out the data from Excel into a .csv file and use read.csv - use Baird's dataload utility (search Google) and convert the .xls file to .rda format and then use the R load command. You can alternately use dataload to convert the xls file to csv or text and then proceed as above. - use the RODBC package to directly read the .xls file. - use the RDCOM package. Its not in CRAN so search for it. This also directly reads the .xls file. _______________________________________________ No banners. No pop-ups. No kidding. Introducing My Way - http://www.myway.com