+ Reply to Thread
Page 6 of 10 FirstFirst 1 2 3 4 5 6 7 8 9 10 LastLast
Results 76 to 90 of 138

Thread: An R learning project (feel free to learn with me)

  1. #76
    ggplot2orBust
    Points: 32,684, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    User with most referrersActivity Award
    trinker's Avatar
    Location
    Buffalo, NY
    Posts
    3,834
    Thanks
    1,272
    Thanked 716 Times in 642 Posts

    Re: An R learning project (feel free to learn with me)




    I'm thinking then that using ggplot2 for the google plots doesn't give me any advantage over what you've done here? Would you agree? (PS I tried your code for addresses in my area, great looking map and accurate.)
    "If you torture the data long enough it will eventually confess."
    -Ronald Harry Coase -

    I really *really* REALLY love bots.

  2. #77
    Probably A Mammal
    Points: 17,788, Level: 84
    Level completed: 88%, Points required for next Level: 62
    bryangoodrich's Avatar
    Location
    Sacramento, California, United States
    Posts
    2,154
    Thanks
    285
    Thanked 478 Times in 436 Posts

    Re: An R learning project (feel free to learn with me)

    Don't know. Not entirely sure what the ggplot method was accomplishing. For simplicity, I'm trying to understand the functions that case study uses. For instance, it manipulates the graphic itself with that image package it uses. Frankly, this is probably because it is trying to transfer over what the RgoogleMaps plotting function does to the ggplot plotting structure. That requires some tweaking. The difference, I would suspect, is that the RgoogleMaps is limited in what you can do compared to what using other libraries can offer, but that takes work. For instance, if you wanted to generate the heat maps and topomaps, that the case study does, you're gonna have to be able to plot those lines and colors onto the map, which requires that your use of lines and points and other functions are in the same parameter space as your map canvas. This is something brought up in the RgoogleMaps vignette, if I recall correctly, but it references using another package, also.

    For a simple pin map (plotting points-to-locations), there's no reason to use all the bells and whistles when the one package handles it all. But you will notice that RgoogleMaps uses the png library. I assume what it does is very simple: read an image raster in as a grid. It is then doing something similar to what the case study did using its own image processing. Frankly, I'd like to see this done in a more generic fashion that can be more easily translated to base-r. I'd also understand more what is going on!

  3. The Following User Says Thank You to bryangoodrich For This Useful Post:

    trinker (02-13-2012)

  4. #78
    ggplot2orBust
    Points: 32,684, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    User with most referrersActivity Award
    trinker's Avatar
    Location
    Buffalo, NY
    Posts
    3,834
    Thanks
    1,272
    Thanked 716 Times in 642 Posts

    Re: An R learning project (feel free to learn with me)

    I have been pretty busy the past couple of days but am moving forward on learning with this project. Earlier I had discussed wanting to read in an access file but thought I'd put it off. Well I discovered something interesting in this data set (a bi modal test distribution in counties that I believe have a higher poverty rate). I need to confirm the poverty thing and thus need some data to support this. This MS access data (LINK) is in a zip file so I am trying to read save it into the working directory using R and then read in the pieces I want using the RODBC package. I'm patterning this off of a post (LINK) bryangoodrich posed in the the R TIL thread. I'm running into some problems right now and not sure why. Any help is appreciated:

    Code: 
    temp <- tempfile()
    download.file("https://reportcards.nysed.gov/zip/SRC2010.zip", temp)
    data <- read.table(unz(temp, "a1.dat"))
    unlink(temp)
    The 2nd step results in the following error:
    Code: 
    > download.file("https://reportcards.nysed.gov/zip/SRC2010.zip", temp)
    Error in download.file("https://reportcards.nysed.gov/zip/SRC2010.zip",  : 
      unsupported URL scheme
    "If you torture the data long enough it will eventually confess."
    -Ronald Harry Coase -

    I really *really* REALLY love bots.

  5. #79
    Beep
    Points: 58,109, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Discussion EnderPosting AwardCommunity AwardMaster TaggerFrequent Poster
    Dason's Avatar
    Location
    Ames, IA
    Posts
    10,683
    Thanks
    249
    Thanked 2,054 Times in 1,754 Posts

    Re: An R learning project (feel free to learn with me)

    I don't believe download.file works with https.
    001100010010011110100001101101110011

  6. The Following User Says Thank You to Dason For This Useful Post:

    trinker (02-15-2012)

  7. #80
    ggplot2orBust
    Points: 32,684, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    User with most referrersActivity Award
    trinker's Avatar
    Location
    Buffalo, NY
    Posts
    3,834
    Thanks
    1,272
    Thanked 716 Times in 642 Posts

    Re: An R learning project (feel free to learn with me)

    Thanks Dason. I just noticed it was an https. Any other ideas or is manually downloading it the only way? RCurl maybe?
    "If you torture the data long enough it will eventually confess."
    -Ronald Harry Coase -

    I really *really* REALLY love bots.

  8. #81
    Beep
    Points: 58,109, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Discussion EnderPosting AwardCommunity AwardMaster TaggerFrequent Poster
    Dason's Avatar
    Location
    Ames, IA
    Posts
    10,683
    Thanks
    249
    Thanked 2,054 Times in 1,754 Posts

    Re: An R learning project (feel free to learn with me)

    I'm pretty sure RCurl should be able to handle it.
    001100010010011110100001101101110011

  9. #82
    ggplot2orBust
    Points: 32,684, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    User with most referrersActivity Award
    trinker's Avatar
    Location
    Buffalo, NY
    Posts
    3,834
    Thanks
    1,272
    Thanked 716 Times in 642 Posts

    Re: An R learning project (feel free to learn with me)

    Uggg! I'm getting an error that I got before but I can't remember what the error means or how to deal with it. I looked at RCurl's help manual and tried url.exists which R tells me it doesn't why? Is the is the reason for the error? Maybe no https will exist.

    Code: 
    require(RCurl)
    NYSdemo <- getURL("https://reportcards.nysed.gov/zip/SRC2010.zip")
    
    #GIVES THIS ERROR
    > NYSdemo <- try(getURL("https://reportcards.nysed.gov/zip/SRC2010.zip"))
    Error in function (type, msg, asError = TRUE)  : 
      SSL certificate problem, verify that the CA cert is OK. Details:
    error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

    Code: 
    > url.exists("https://reportcards.nysed.gov/zip/SRC2010.zip")
    [1] FALSE
    "If you torture the data long enough it will eventually confess."
    -Ronald Harry Coase -

    I really *really* REALLY love bots.

  10. #83
    Phineas Packard
    Points: 8,379, Level: 61
    Level completed: 77%, Points required for next Level: 71
    Lazar's Avatar
    Location
    Sydney
    Posts
    808
    Thanks
    139
    Thanked 211 Times in 191 Posts

    Re: An R learning project (feel free to learn with me)

    I can get past the first error with :

    Code: 
    download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
    
    NYSdemo <- getURL("https://reportcards.nysed.gov/zip/SRC2010.zip",cainfo = "cacert.pem")
    But then this creates a new error.

    Code: 
    Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding)

  11. The Following User Says Thank You to Lazar For This Useful Post:

    trinker (02-15-2012)

  12. #84
    ggplot2orBust
    Points: 32,684, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    User with most referrersActivity Award
    trinker's Avatar
    Location
    Buffalo, NY
    Posts
    3,834
    Thanks
    1,272
    Thanked 716 Times in 642 Posts

    Re: An R learning project (feel free to learn with me)

    I think I'm going to put this up on SO and see if any of the brains there can help. I'll link it back here.
    "If you torture the data long enough it will eventually confess."
    -Ronald Harry Coase -

    I really *really* REALLY love bots.

  13. #85
    Beep
    Points: 58,109, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Discussion EnderPosting AwardCommunity AwardMaster TaggerFrequent Poster
    Dason's Avatar
    Location
    Ames, IA
    Posts
    10,683
    Thanks
    249
    Thanked 2,054 Times in 1,754 Posts

    Re: An R learning project (feel free to learn with me)

    On SO I can downvote you for being a raptor.
    001100010010011110100001101101110011

  14. #86
    ggplot2orBust
    Points: 32,684, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    User with most referrersActivity Award
    trinker's Avatar
    Location
    Buffalo, NY
    Posts
    3,834
    Thanks
    1,272
    Thanked 716 Times in 642 Posts

    Re: An R learning project (feel free to learn with me)

    Oh great now they're going to know you're crazy there too. They had thought you somewhat normal before.
    "If you torture the data long enough it will eventually confess."
    -Ronald Harry Coase -

    I really *really* REALLY love bots.

  15. #87
    Phineas Packard
    Points: 8,379, Level: 61
    Level completed: 77%, Points required for next Level: 71
    Lazar's Avatar
    Location
    Sydney
    Posts
    808
    Thanks
    139
    Thanked 211 Times in 191 Posts

    Re: An R learning project (feel free to learn with me)

    I might change you post at SO a little trinker because that errer you got is a very common one that can be solved the way I showed or by including ssl.verifypeer = FALSE in the get URL call. The problem you have I think is different so you might not get the most useful feedback.

  16. The Following User Says Thank You to Lazar For This Useful Post:

    trinker (02-15-2012)

  17. #88
    Beep
    Points: 58,109, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Discussion EnderPosting AwardCommunity AwardMaster TaggerFrequent Poster
    Dason's Avatar
    Location
    Ames, IA
    Posts
    10,683
    Thanks
    249
    Thanked 2,054 Times in 1,754 Posts

    Re: An R learning project (feel free to learn with me)

    Quote Originally Posted by trinker View Post
    Oh great now they're going to know you're crazy there too. They had thought you somewhat normal before.
    I don't need to leave a comment like:
    (-1) For being raptor.

    But you would know why. Although I'm not actually going to do that.
    001100010010011110100001101101110011

  18. #89
    ggplot2orBust
    Points: 32,684, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    User with most referrersActivity Award
    trinker's Avatar
    Location
    Buffalo, NY
    Posts
    3,834
    Thanks
    1,272
    Thanked 716 Times in 642 Posts

    Re: An R learning project (feel free to learn with me)

    Lazar any ideas of a title? Suggested edits?
    "If you torture the data long enough it will eventually confess."
    -Ronald Harry Coase -

    I really *really* REALLY love bots.

  19. #90
    Phineas Packard
    Points: 8,379, Level: 61
    Level completed: 77%, Points required for next Level: 71
    Lazar's Avatar
    Location
    Sydney
    Posts
    808
    Thanks
    139
    Thanked 211 Times in 191 Posts

    Re: An R learning project (feel free to learn with me)


    Ok try the following

    Code: 
    download.file("https://reportcards.nysed.gov/zip/SRC2010.zip", destfile="test.zip", mode="wb")
    It started downloading something put the file is large so I stopped half way through.

    EDIT: I have now tried this on two windows systems and it is working fine.
    Last edited by Lazar; 02-16-2012 at 02:31 AM.

+ Reply to Thread
Page 6 of 10 FirstFirst 1 2 3 4 5 6 7 8 9 10 LastLast

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats