Watts-College / cpp-529-spr-2022

https://watts-college.github.io/cpp-529-spr-2022/
0 stars 2 forks source link

Running the Locator function #11

Closed ramacdo1 closed 2 years ago

ramacdo1 commented 2 years ago

Hello! I am struggling with getting the locator() function running, or any of the suggested ways to find the boundaries. Whichever method I choose, as described in the video in the instructions, I am running into this error code: Error in locator(las_dorling) : plot.new has not been called yet

If I run plot.new(las_dorling), I get the following error, Error in plot.new(las_dorling) : unused argument (las_dorling)

With respect to my other code, I have followed the instructions quite faithfully. My last code before I have been attempting to run the locator function is:

{r} tm_shape(las_dorling) + tm_polygons(size="POP", col="hinc12", n=7, style="quantile", palette= "Spectral") If anyone knows where I am going wrong, I'd love the assistance! Otherwise, @u12345 or @JasonSills, do you maybe know where I could be going wrong? Thanks in advance!

u12345 commented 2 years ago

@ramacdo1 Have called plot()?

ramacdo1 commented 2 years ago

Good afternoon @u12345 ,

plot(las_dorling) %>% 
  locator()

I ran this, and got this error: Error in locator(.) : invalid number of points in locator()

u12345 commented 2 years ago

@ramacdo1 Have defined las_dorling variable?

u12345 commented 2 years ago

@ramacdo1 https://www.rdocumentation.org/packages/graphics/versions/3.6.2/topics/locator

JasonSills commented 2 years ago

Hi @ramacdo1 ,

Let's walk through this step by step. Let me know if this works.

First, make sure you have clicked on "Plots". This should be between "Files" and "Packages". This is where you are going to see the map where you will click for the coordinates.

Second, don't run locator() in a code chunk. It's going to be in your console.

Third, in console type plot(las_dorling) and run this line in your console, not in a chunk. Now you should see it appear in Plots.

Fourth, now run locator() in the console. Now you should be able to click on the locations in your Plots window. There should be a "Finish" button that you click when you're done.

Finally, your coordinates should be in the console.

ramacdo1 commented 2 years ago

Good evening @JasonSills , Thank you, I was indeed running it in as a code chunk, once I ran it in the console, everything worked!

Thank you and @u12345 for your help!