Dear all, I've been using R on a Mac to process some data for export to ArcMap GIS (which only runs on Windows). ArcMap seems to require tab-delimited data (my data are in 3 columns), so I've been using the sep="\t" argument. However, this resulted in strange end-of-line characters when displayed on a PC. I looked in the write.table help file to find that eol="\r\n" can be used to get around this problem, and it does indeed prevent these unwanted characters from appearing. However, the data still aren't properly recognised by ArcMap when created on a Mac (the exact same code works fine from a PC). In ArcMap, when I select 'Display XY Data', the X (Longitude) and Y (Latitude) columns aren't available to select. It's as if Arc isn't correctly interpreting the output from R - this is despite me using col.names=TRUE in the write.table command. Any light shed on this will be very gratefully received. Many thanks for your help, Steve _________________________________________________________________ We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
Hi Steve, As I have no problem with this because I run windows, I prefere to use .txt files. But may be on your case you install xlsReadWrite (or WriteRead), because .xls file works fine for ArcGis. Remember not use complex (like having dots) or large names because some times you get error on ArcGis. Good luck, milton On Mon, Jan 25, 2010 at 12:54 PM, Steve Murray <smurray444@hotmail.com>wrote:> > Dear all, > > I've been using R on a Mac to process some data for export to ArcMap GIS > (which only runs on Windows). ArcMap seems to require tab-delimited data (my > data are in 3 columns), so I've been using the sep="\t" argument. However, > this resulted in strange end-of-line characters when displayed on a PC. I > looked in the write.table help file to find that eol="\r\n" can be used to > get around this problem, and it does indeed prevent these unwanted > characters from appearing. > > However, the data still aren't properly recognised by ArcMap when created > on a Mac (the exact same code works fine from a PC). In ArcMap, when I > select 'Display XY Data', the X (Longitude) and Y (Latitude) columns aren't > available to select. It's as if Arc isn't correctly interpreting the output > from R - this is despite me using col.names=TRUE in the write.table command. > > Any light shed on this will be very gratefully received. > > Many thanks for your help, > > Steve > > > _________________________________________________________________ > We want to hear all your funny, exciting and crazy Hotmail stories. Tell us > now > > ______________________________________________ > 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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Hi Steve, On Mon, Jan 25, 2010 at 12:54 PM, Steve Murray <smurray444 at hotmail.com> wrote:> > Dear all, > > I've been using R on a Mac to process some data for export to ArcMap GIS (which only runs on Windows). ArcMap seems to require tab-delimited data (my data are in 3 columns), so I've been using the sep="\t" argument. However, this resulted in strange end-of-line characters when displayed on a PC. I looked in the write.table help file to find that eol="\r\n" can be used to get around this problem, and it does indeed prevent these unwanted characters from appearing.How did you look at the output? in Excel?> However, the data still aren't properly recognised by ArcMap when created on a Mac (the exact same code works fine from a PC). In ArcMap, when I select 'Display XY Data', the X (Longitude) and Y (Latitude) columns aren't available to select. It's as if Arc isn't correctly interpreting the output from R - this is despite me using col.names=TRUE in the write.table command.I usually use col.names=NA, when I am writing a file to be read by a spreadsheet. This is also documented in ?write.table. As Milton pointed out you should also make sure that you are careful with your column names since R and ArcMap have different rules. Posting the results of str(YourData) might shed some light as well. Hope this helps, Michael> > Any light shed on this will be very gratefully received. > > Many thanks for your help, > > Steve > > > _________________________________________________________________ > We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now > > ______________________________________________ > 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. >-- Michael Denslow I.W. Carpenter Jr. Herbarium [BOON] Department of Biology Appalachian State University Boone, North Carolina U.S.A. -- AND -- Communications Manager Southeast Regional Network of Expertise and Collections sernec.org 36.214177, -81.681480 +/- 3103 meters
Steve Murray wrote:> Dear all, > > I've been using R on a Mac to process some data for export to ArcMap GIS (which only runs on Windows). ArcMap seems to require tab-delimited data (my data are in 3 columns), so I've been using the sep="\t" argument. However, this resulted in strange end-of-line characters when displayed on a PC. I looked in the write.table help file to find that eol="\r\n" can be used to get around this problem, and it does indeed prevent these unwanted characters from appearing. > > However, the data still aren't properly recognised by ArcMap when created on a Mac (the exact same code works fine from a PC). In ArcMap, when I select 'Display XY Data', the X (Longitude) and Y (Latitude) columns aren't available to select. It's as if Arc isn't correctly interpreting the output from R - this is despite me using col.names=TRUE in the write.table command. > > Any light shed on this will be very gratefully received. > > Many thanks for your help, > > Steve > > > _________________________________________________________________ > We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now > > ______________________________________________ > 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. >Hi, In addition to the other people. If you convert your data in R to one of the spatial classes (see the sp-pacakge) you can use the rgdal-package to dump these objects to e.g. a shapefile. This can be read by ArcGIS. As a note, there is a special mailing list for geographic data and R, r-sig-geo, which might be a better place to ask these kind of specific questions. good luck! Paul -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul
Dear all, Just to let you know that thanks to your help, I've managed to solve it. For future reference, if anyone's interested (!), if you're having problems reading R-generated data from a Mac, into ArcMap on a PC, then ensure that you're using eol="\r\n" in the write.table command and that you don't have factor or character data when they're really meant to be numeric! To overcome the latter, I did: mrunoff$Longitude <- as.numeric(levels(mrunoff$Longitude))[mrunoff$Longitude] Hope this is of use to someone, somewhere, someday! Thanks again for your advice, Steve _________________________________________________________________ Got a cool Hotmail story? Tell us now