? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080808/aa9e5eab/attachment.pl>
Dear Alessando, I donĀ“t know if I understood well your question, but my be you are not "losting" the precision. Try change the options(digits=10). If you want to output with "," as sepatator, try something like write.table(testground, "my_output.txt", sep=",", append=F, quote=F, row.names=F) but if you want TAB as sepatador try this: write.table(testground, "my_output.txt", sep="\t", append=F, quote=F, row.names=F) Best wishes miltinho astronauta brazil On 8/8/08, Alessandro <alessandro.montaghi@unifi.it> wrote:> > Hi All, > > > > I have 2 questions: > > 1. Import: when I import my txt file (X,Y and Z) in R with > "testground > <- read.table(file="c:/work_LIDAR_USA/R_kriging/ground26841492694149.txt", > header=T)", I lost the 4 number after the point ("."). does It possible > add > in the code the possibility to read the 4 numbers after the . > > > > 2. Does It possible to write a X, Y, Z *txt file without the ID in R > and sep"," for the rows? > > > > Example: > > Original data: > > X Y Z > > 26800.4700 4149983.9400 1543.3900 > > ....... ......... ...... > > > > I wish to create a txt file (with "," sep): > > X, Y, Z > > 26800.4700, 4149983.9400, 1543.3900 > > ......., ........., ...... > > > > Thanks (It's Friday night, sorry I am tired) > > > > Ale > > > [[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. >[[alternative HTML version deleted]]
On Fri, Aug 08, 2008 at 04:44:13PM -0700, Alessandro wrote:> Hi All, > > > > I have 2 questions: > > 1. Import: when I import my txt file (X,Y and Z) in R with "testground > <- read.table(file="c:/work_LIDAR_USA/R_kriging/ground26841492694149.txt", > header=T)", I lost the 4 number after the point ("."). does It possible add > in the code the possibility to read the 4 numbers after the . >I think the problem is simply that you have options()$digits set to 7 (the default). Read the 'digits' section in help(options) and try options(digits=11)> > > 2. Does It possible to write a X, Y, Z *txt file without the ID in R > and sep"," for the rows? >write.csv(your.data.frame, row.names=FALSE, quote=FALSE) x <- read.table("path/to/your/file.txt", header=T) x # X Y Z # 1 26800.47 4149984 1543.39 # 2 26800.47 4149984 1543.39 options(digits=11) x # X Y Z # 1 26800.47 4149983.94 1543.39 # 2 26800.47 4149983.94 1543.39> write.csv(x, row.names=FALSE, quote=FALSE)# X,Y,Z # 26800.47,4149983.94,1543.39 # 26800.47,4149983.94,1543.39 Dan> > > Example: > > Original data: > > X Y Z > > 26800.4700 4149983.9400 1543.3900 > > ....... ......... ...... > > > > I wish to create a txt file (with "," sep): > > X, Y, Z > > 26800.4700, 4149983.9400, 1543.3900 > > ......., ........., ...... > > > > Thanks (It's Friday night, sorry I am tired) > > > > Ale > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.