POST
|
Kayla, Good catch on the adehabitateHS requiring sp. However, if I understand correctly, you did not reload the packages and/or did not restart R/RStudio? It would seem that something has gone astray because you are right, you have lost many of your grid locations and corresponding data. I am not sure what caused this to occur, this is an issue I have not come across before in the course of this lesson. As a first step, I would start by saving your R lines of code into a script file. This way you can easily re-run each line of code without have to retype them. I would then close R and opt to not save your R workspace. Reopen R and rerun all of the lines of code to see if you reproduce the same result with the packages being loaded correctly. If the results are reproduced, can you put your data in a zipped folder and send it to me (mpobuda@esri.com)? I can check on my end if I can reproduce your results as well. Thank you and hopefully we will get to the bottom of this soon! -Marjean
... View more
01-07-2019
12:21 PM
|
0
|
2
|
2264
|
POST
|
Hi Kayla, Awesome - I am glad you were able to figure out that first issue. Let's see if we can figure out your new issue. I have run into this problem myself several times and it can be quite frustrating. I think R is struggling in your case because the package sp is required by the package raster. So when R is trying to remove sp it is getting stuck because the raster package is saying, "Hey, don't do that, I need this." Restarting is one way to get around this, but it comes at the cost of losing all of your code and progress so far. Another option is to use the detach function in R. To do this, I believe you would start by actually removing the raster package itself to get rid of the conflict between it and sp. This would look like the following: detach("package:raster", unload=TRUE) You can then try doing the same thing for the sp package just in case it is still lingering around: detach("package:sp", unload=TRUE) I believe you should now be good to reload the raster package which will automatically come with sp and you should be able to continue on in the lesson. library(raster) Let me know how this works for you or if you run into any other issue. Thank you! -Marjean
... View more
01-04-2019
09:31 AM
|
0
|
4
|
2264
|
POST
|
Hi Kayla, I am sorry to hear that you are running into problems, hopefully I can help. Would you be able to send me what you entered in step 4 of the lesson and what the R console returned to you after entering that code? Step 4 asks that you define the variable 'data_path' by entering the following code: data_path <- arc.open("C:/African-Buffalo/Ecological Niche Factor Analysis.gdb/ENFA_Environmental_Buffalo_Attributes") Just as a note though, the location you saved your data at might be different. For example, you might have picked a different folder location and as a result, will need to adjust the path to reflect the folders you used to store the lesson's data in. Additionally, R only recognizes forward slashes ("/") and when you copy a path directly from Windows File Explorer, it contains back slashes ("\") so those need to be adjusted in order for R to know where your data is located. I am curious what happened after this step, such as if R threw a warning or error. The reason I ask is because the current error you are seeing says that the variable 'data_path' is not defined. This means that R is says it unaware of any variable called 'data_path' and as a result, is unsure of how to handle your most recent line of code since it uses that variable. Let me know when you have the chance. Thank you!
... View more
12-31-2018
03:12 PM
|
0
|
6
|
2264
|
BLOG
|
Meet our guest authors: Jonathan L Wilson, PhD is partner and Chief Data Scientist for Retail Scientifics with over a decade of experience delivering best-in-class custom predictive models for a wide variety of clients. Zack Garza is the Sr. Math Wizard for Retail Scientifics specializing in Python, R, and mathematically intensive projects. Introduction When it comes to solving the problems we face in the world today, we need the best available tools. Often, that means needing to integrate multiple platforms together. Unfortunately, this task can be unnecessarily time-consuming and complicated, especially when specific pieces do not ‘play nicely’ together. Additionally, with the ever-increasing size of data available to analyze and the demand for automated methods to generate the latest results instantly, analysts and data scientists alike are finding their time increasingly stretched thin. ArcGIS seeks to help mitigate these issues by providing a framework for integration between platforms at multiple levels. The free and open-source R ecosystem is one of the most widely used statistical programming languages. It provides a large collection of predictive machine learning algorithms for data scientists and analysts to leverage, along with an active and vibrant support community producing high-quality documentation and resources. As such, R tends to be on the forefront of cutting-edge predictive analytics methods and novel field-specific statistical algorithms. The GIS-focused software ArcGIS, offers a powerful suite of vetted spatial analysis methods combined with an extensive platform to ease a variety of tasks that utilize its rich spatial data, dynamic mapping, visualization capabilities, and integration with Python. Here we present one such example of an integrated solution designed by Retail Scientifics to leverage the power of R from within the ESRI ecosystem using ESRI’s Web AppBuilder framework as a web-based front-end application. This approach allows data scientists to develop high quality technical models within R, while simultaneously allowing non-technical users to employ these models via a user-friendly, spatially-enabled interface. Example: Retail Site Selection Predictive modeling in areas such as sales forecasting, marketing, and operations analysis is a necessity to thrive in today’s business environment. A significant competitive advantage can be gained by combining such modeling with spatial data. For example, a common scenario in the retail world is a desire for a retailer to expand by opening new locations. As this typically requires significant financial investments, predicting future performance is a key way of prioritizing which locations might yield the most potential revenue. With such revenue forecasts in hand, one can be much more confident about the possible relative performance of a location before making high-risk, capital-intensive decisions. Approaches to revenue forecasting have evolved considerably over time, from simple summaries of population and income data, to computationally-intensive ensemble modeling techniques that incorporate historical trends and performance. In the presence of big data however, what might have been possible for a traditional analyst to accomplish with simple techniques, such as linear regression, now requires considerably more programmatic horsepower to obtain accurate forecasts. In support of the more contemporary approaches, each potential retail location can be enriched with thousands of demographic variables, as well as a host of other spatial data such as expenditures and location attributes -- all of which can be used in the construction of a predictive model. It is a complex task to ensure that the model is built correctly, particularly when working with a large volume of data that is typically highly correlated, but such models can yield highly accurate forecasts that can quantitatively inform enterprise decisions and create immense value. The front-end interface using ESRI’s WebApp Builder marries up easily to use cloud-based services with the high-powered R-based models developed for predictive modeling. This creates a useful bridge allowing for data scientists to build complex models which can be leveraged by non-technical individuals within the business. Building a Model Examples of powerful algorithms commonly used for forecasting in enterprise applications (such as revenue prediction, marketing applications, operation analysis, pricing optimization, and more) include, but are not limited to, regularized generalized linear models, neural networks, and spatial regression. While a number of these algorithms are integrated into the ArcGIS platform, niche libraries tailored for specific prediction types are easily available as R packages, which can be installed with a single line of code. For those interested in building models directly, please see the Github repository for a more detailed view of how such models can be constructed and used to generate forecasts. For demonstrative purposes we utilize one of the simplest type of models in this example: an ordinary linear regression. However, for actual applications and greater predictive accuracy, it is advised to test the application of more contemporary algorithms and techniques. Using the Model To solve the challenge of delivering a complex and computationally intensive predictive model to non-technical users, Retail Scientifics has developed an easy to use web-based front-end built on Web AppBuilder, which calls a cloud-based API that references R code for the model. Once a model is constructed and properly calibrated by a skilled data scientist, this approach allows the model to be leveraged by a broad range of users through a simple form interface. We present an example of this integration below for a multi-outlet sales forecasting application, along with a live demonstration that can be accessed here. For a user to obtain a new prediction, they simply click on the map to identify a location to execute the model, enter a few key site characteristics, and click the “Run Estimate” button. The R model is then called behind the scenes via the API and returns structured data back to the ESRI front-end, which includes the dynamically generated estimate from the predictive model. In production deployments, the output is often quite customized, including more spatial and client-specific data, which we then structure into various charts and tables to yield a comprehensive report: Possible Extensions The above example highlights how powerful functionality can easily be accessed in an approachable and user-friendly format. Such a workflow can also be expanded to utilize the R-ArcGIS bridge. The arcgisbinding package, for example, offers the ability to easily convert between a variety of ArcGIS data types, including file-based geodatabases, layer files, hosted feature layers, raster layers, and more. This package extends the functionality of existing spatial R packages, with the added benefit of being able to perform custom data manipulations like subsets, selections based on SQL queries, and reprojections, all within the same function call. Integration across multiple platforms allows for the development of analytical tools that are not only powerful in their methodology, but also easy to share and approachable for users. This is a great example of how integration helps drive us forward to solve bigger problems in new ways. For further discussions about what the R-ArcGIS bridge can do for your workflows, check out our GeoNet community or feel free to send an email. If you have questions or would like to learn more about this solution, do not hesitate to get in touch with Retail Scientifics. About Retail Scientifics Retail Scientifics is a boutique data science consulting firm. Many of our clients leverage our custom-built spatial analytics models and tools through ESRI platforms. We are experts in modeling, data collection and analysis, and are the market leaders in prediction accuracy. We have expertise in combining spatial and statistical analytics, particularly in the retail and restaurant domains. Visit us as https://www.retailscientifics.com/ or via email at info@retailscientifics.com This content was coauthored by Jonathan L. Wilson PhD, Marjean Pobuda, and Zack Garza
... View more
10-12-2018
11:55 AM
|
1
|
0
|
531
|
POST
|
Hi Kenta, You can transfer your R data frame object to ArcGIS as a table like you describe. Based on your code, it looks like you might just need a minor modification or two. One problem might be the subset you have created. df <- read_excel("G:/AllData/Kyuson_Aza/Kyuson_AzaListFinal.xlsx") df2 <- df[2,4] In this case, you are asking for object df2 to contains the element in the second row and fourth column. This means this new object would no longer be a data frame but rather, the type of element contained in that location. In which case, the arc.write() function would not recognize it as a valid object to write. However, if you made a larger subset that still was a data frame: df <- read_excel("G:/AllData/Kyuson_Aza/Kyuson_AzaListFinal.xlsx") df2 <- df[2:3,4:6] You could write it back using the following line: arc.write(path = "C:/Users/kenta/Documents/ArcGIS/Projects/MyProject2/MyProject2.gdb", data = df2, overwrite = TRUE) That last parameter is key. Based on the error you provide, it seems you may have already written a table but, are now trying to overwrite it and are currently being prevented from doing so. I hope this helps! -Marjean
... View more
09-10-2018
03:47 PM
|
1
|
2
|
1211
|
BLOG
|
Esri’s 2018 UC was a spectacular event for the R-ArcGIS bridge. Not only did the bridge unveil its support for raster data this year, along with the release of multiple new resources, but also, session turnout was at an all-time high. 2018 marked the first year the R-ArcGIS bridge team offered a full-day, hands-on, preconference seminar on the bridge, Statistical Spatial Data Analysis with R and ArcGIS, which featured all the latest regarding using the bridge within R, ArcGIS, Jupyter notebooks, and alongside Conda and Python. As the thrill from UC transitions back into daily routines, there is no better time to catch-up with the latest developments on the bridge and to build it into your workflows. Let the R-ArcGIS bridge help you expand your analyses by bringing in the latest statistical and field-specific methods from R and by making sharing your results easy. If you have already been working with the R-ArcGIS bridge and are eager to dive into the latest advancements, make sure you update your arcgisbinding package to the latest version to checkout several new functions. We have also updated our documentation included in R/RStudio to provide even more details and examples on how you can utilize the bridge in your workflows. To learn how you can do this and to access this documentation, see our latest resource on installing and setting-up the R-ArcGIS bridge, which includes details for every different installation option, along with information on how to update the bridge. If you are new to the bridge, or looking for an easy way to apply what you saw at the UC, take advantage of all of our newest resources detailing everything from getting started with the bridge, to R code examples on the bridge's reading, converting, and writing functionality, to script tool creation and sharing results, to the bridge's support for mosaic datasets and time-series rasters, and finally, a bonus resource on getting started with Conda. For full-length workflows detailing the power of the bridge in action, consider checking out our learn lessons on determining a suitable habitat for African buffalo or on analyzing crime in San Francisco. The bridge represents an exciting frontier into the full integration of ArcGIS’ spatial analysis power with novel, and field-specific statistical analyses from R. Stay tuned for more posts with details on new ways to make this integration even more versatile with support for big data and with the ability to work exclusively in R. Happy bridging!
... View more
08-07-2018
01:36 PM
|
2
|
0
|
863
|
POST
|
Dan, It is my understanding the repository was updated to include new documentation for the arcgisbinding R package since we recently added new functions for handling raster support. I am afraid I am still not following on the need for separate installs. Maybe S.W can help to fill in the gaps. Definitely send your students our way, we'd be happy to speak with them! -Marjean
... View more
07-09-2018
04:41 PM
|
0
|
1
|
846
|
POST
|
Hi Dan, I am sorry for the delay, UC week and the weeks before have been quite hectic. However, I am not sure if I fully understand your question. There are no new limitations when it comes to 2.2 and the R-ArcGIS bridge functionality. The R-ArcGIS bridge is completely separate from the Python Package Manager and Conda by default, so there is no need for a cloned environment to use any bridge functionality. That being said, it would seem though that you might have run into issues while trying to create a clone of your arcgispro-py3 environment. If you wish to modify your arcgispro-py3 environment, you do first need to clone it in Pro 2.2. This new requirement was put into place by the Python team to help ensure no one modified the environment for Pro to the point of breaking it beyond repair. I have had success in cloning my environment in order to create a new environment in which I have installed packages I wanted to. If you have found an issue though, I am sure the Python team would be happy to help investigate. Could you maybe provide some more details or stop by the Spatial Analytics Island to see us, if you are in town for the UC? Hope this helps somewhat, Marjean
... View more
07-09-2018
04:12 PM
|
0
|
1
|
846
|
POST
|
Giacomo, Based on your description, I think option 1 would be the easiest way to go since you already have a geoprocessing service that does what you need. Otherwise, you would probably need to recreate all of the geoprocessing service functionality in R, which would require time and effort that wouldn't necessarily get you any added benefits (assuming you are looking to exactly replicate functionality). ModelBuilder will allow you to easily pass the results from the geoprocessing service into your R script tool to perform your financial calculations before ultimately returning the final results for you in your map to either further analyze or visually examine. For reference though, there is an R package known as reticulate which allows you to call Python from within R. This might be of interest for you down the road. We have done some limited testing of it and found it to work well. In general, I am a fan of not duplicated work that already exists and does what you need but, hopefully this helps to give you some ideas of options. -Marjean
... View more
05-21-2018
04:25 PM
|
1
|
0
|
876
|
POST
|
Thomas, Thank you for all of your time in trying out these different options. I am sorry this is proving to be so complicated. Based on your comment though, it sounds like if you make a minor tweak, you should be able to get the bridge installed. 1) I have a feeling this might not work, but if you have time, try following the instructions for an offline installation of the bridge. Offline Installation From a machine that does have internet access: download this repository download the latest version of the arcgisbinding package. Copy both zip files onto the machine that you're targeting offline installation. Extract the r-bridge-install zip. Place the arcgisbinding_1.0.0.128.zip into the same directory as the "R Integration" Python toolbox. Run the installation procedure as you previously did in 1) That error message saying, "Unable to access online package, and no local copy of package found." should be gone but, my guess is that there will still be some type of folder issue error since something about that structure on your machine is different than expected. I am mostly just curious what it will say ... 2) So it appears that R was able to install the package ... but not in the expected location of C:\Users\<insert-your-user-name-here>\Documents\R\win-library\3.3. So where did it install? A couple of things: - First, copy the arcgisbinding folder that is located inside of your zipped folder and manually paste it in your ...\Documents\R\win-library\3.3 folder. - In R, run the following: library(arcgisbinding) arc.check_product() You should have succeeded in, hopefully, beating the system and having both R and ArcGIS now recognize the arcgisbinding package and therefore, have the bridge installed. *Fingers crossed, Marjean
... View more
02-23-2018
11:44 AM
|
0
|
1
|
2613
|
POST
|
Hi Thomas, I have to admit, I am a bit baffled. Without access to your machine, it gets tricky to pinpoint what is the problem as I am unable to reproduce the issue. We have two possible workarounds to see if we can get the bridge installed for you. 1) Can you try to see if you can install the bridge using the Python installer? The process for installing this way is detailed in this installation video. This installation process will still work for later versions of Pro than 1.4.1, like Pro 2.1. 2) Alternatively, you can manually install the bridge through R by following these steps: - Close Pro - Download the arcgisbinding_1.0.0.128.zip - Open R 3.3.1 64-bit - Click the Packages tab and select Install Package(s) from local files... - Navigate to and select arcgisbinding_1.0.0.128.zip. You should see a message the packages has installed. - Reopen Pro and navigate to the R-Bridge Support under the Project tab's Geoprocessing Options. When you select R version 3.3.1 from the drop-down, you should now see that the arcgisbinding package is installed. Let me know how it goes! -Marjean
... View more
02-22-2018
03:58 PM
|
0
|
3
|
1754
|
POST
|
Hi Saffet, It appears that you are working with the latest version of R, 3.4.3. If this is the case, there are two ways you could solve this issue. 1) On R 3.4.3 you need to add C:/Program Files/R/R-3.4.3/bin/i386 to the PATH environment and then restart ArcMap. (Or if you are using 64 bit ArcGISPro add ..../bin/x64 ). You can find your Path environment variable by right-clicking on This PC in File Explorer and then selected Advanced system settings, followed by Environment Variables. 2) Alternatively, the second solution is to install Beta version of the 'arcgisbinding' package https://github.com/R-ArcGIS/r-bridge/releases/tag/v1.0.1.229-beta Hope this helps. -Marjean
... View more
02-22-2018
03:07 PM
|
1
|
1
|
479
|
POST
|
Hi Saffet, It appears that you are working with the latest version of R, 3.4.3. If this is the case, there are two ways you could solve this issue. 1) On R 3.4.3 you need to add C:/Program Files/R/R-3.4.3/bin/i386 to the PATH environment and then restart ArcMap. (Or if you are using 64 bit ArcGISPro add ..../bin/x64 ). You can find your Path environment variable by right-clicking on This PC in File Explorer and then selected Advanced system settings, followed by Environment Variables. 2) Alternatively, the second solution is to install Beta version of the 'arcgisbinding' package https://github.com/R-ArcGIS/r-bridge/releases/tag/v1.0.1.229-beta Hope this helps. -Marjean
... View more
02-22-2018
03:07 PM
|
0
|
3
|
684
|
POST
|
Thanks Thomas. I tried to reproduce your issue on a machine with Pro 2.1 and R 3.3.1 but I was unable to do so. My best guess right now is that there is some type of local setting on your machine that is confusing the installer. So let's try checking a couple of things: 1) Do you have an R folder located in your Documents? This folder should contain the win-library folder and is where the installer will initially look to install the arcgisbinding package to. 2) Have you modified any of your environmental variables or path regarding R? This can be checked in File Explorer by right clicking on This PC and then selecting Advanced system settings, followed by Environment Variables... Under System variables have you defined any variables pertaining to R? Such as R_HOME? (Just a note: the image here is just an example, having R_HOME set can cause multiple problems since it is hard coding a location that should be fluid). 3) What happens when you try to install the bridge from file? To test this, download the latest version of the bridge and save it to a location of your choice. There is no need to unzip this file. In the R-ArcGIS bridge installer, instead of selecting the option to download and install from the internet, select the option to install from file. Navigate to the location you saved the arcgisbinding_1.0.0.128.zip and select the zipped folder. Just let me know whenever you get a chance. Thank you for your help tracking down this issue. -Marjean
... View more
02-22-2018
11:28 AM
|
0
|
5
|
1754
|
POST
|
Hi Thomas, I am sorry to hear you are running into issues. Based on your snapshot, it appears the installer has successfully recognized the location R 3.3.1 is installed at in C:\Program Files. When are you encountering that error message? What option did you select from the drop-down button to the right of the message that reads: "Please install the ArcGIS R integration package"? Just let me know! Thank you, Marjean
... View more
02-21-2018
01:54 PM
|
0
|
7
|
1754
|
Title | Kudos | Posted |
---|---|---|
1 | 06-01-2017 11:49 AM | |
1 | 05-21-2018 04:25 PM | |
1 | 02-22-2018 03:07 PM | |
1 | 10-20-2017 12:10 PM | |
1 | 09-07-2017 09:41 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|