Re: [R] Help with first S3-class

2018-01-02 Thread Jeff Newmiller
Function arguments are not pass-by-reference... they are pass-by-value. You need to return the altered object to the caller when you are done messing with it. Note that R is a data processing language... your example will not scale to real world use cases because you make no use of vectorizatio

Re: [R] Help with first S3-class

2018-01-02 Thread Martin Møller Skarbiniks Pedersen
Some mistake: > I expect this output: [1] 100 Martin Saldo is: 100 but I get [1] 0 Martn Saldo is: 0 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] Help with first S3-class

2018-01-02 Thread Martin Møller Skarbiniks Pedersen
On 3 January 2018 at 00:52, Duncan Murdoch wrote: > On 02/01/2018 6:38 PM, Martin Møller Skarbiniks Pedersen wrote: >> >> Hi, >> >>I am trying to understand S3 classes. I have read several tutorials >> about >> the topics but I am still a bit confused. I guess it is because it is >> so differe

Re: [R] Help with first S3-class

2018-01-02 Thread Martin Møller Skarbiniks Pedersen
On 3 January 2018 at 00:52, Duncan Murdoch wrote: > On 02/01/2018 6:38 PM, Martin Møller Skarbiniks Pedersen wrote: >> >> Hi, >> >>I am trying to understand S3 classes. I have read several tutorials >> about >> the topics but I am still a bit confused. I guess it is because it is >> so differe

Re: [R] Help with first S3-class

2018-01-02 Thread Duncan Murdoch
On 02/01/2018 6:38 PM, Martin Møller Skarbiniks Pedersen wrote: Hi, I am trying to understand S3 classes. I have read several tutorials about the topics but I am still a bit confused. I guess it is because it is so different from Java OOP. What you do below isn't S3. S3 is a system where t

Re: [R] Discrete valued time series data sets.

2018-01-02 Thread Rolf Turner
On 03/01/18 10:55, Achim Zeileis wrote: The "tscount" package (see http://doi.org/10.18637/jss.v082.i05) comes with several count data time series. Maybe this is the kind of discrete data you were interested in? Yes, that's very useful. Thanks. cheers, Rolf -- Technical Editor ANZJS Depart

Re: [R] Discrete valued time series data sets.

2018-01-02 Thread Rolf Turner
On 03/01/18 06:04, Eric Berger wrote: Hi Rolf, I looked at https://docs.microsoft.com/en-us/azure/sql-database/sql-database-public-data-sets One of the first sets in the list is the airline time series (I think it is also used in dplyr examples). https://www.transtats.bts.gov/OT_Delay/OT_De

[R] Help with first S3-class

2018-01-02 Thread Martin Møller Skarbiniks Pedersen
Hi, I am trying to understand S3 classes. I have read several tutorials about the topics but I am still a bit confused. I guess it is because it is so different from Java OOP. I have pasted my attempt at creating a bank-account class below and my problems are: 1. What should be added some pl

Re: [R] Discrete valued time series data sets.

2018-01-02 Thread Achim Zeileis
The "tscount" package (see http://doi.org/10.18637/jss.v082.i05) comes with several count data time series. Maybe this is the kind of discrete data you were interested in? hth, Z On Tue, 2 Jan 2018, Eric Berger wrote: Hi Rolf, I looked at https://docs.microsoft.com/en-us/azure/sql-database/s

Re: [R] httr::content without message

2018-01-02 Thread Ben Tupper
That's good to know about when to auto-parse and when not to. There is quite a big stable of tools to check the response before you try to read... > httr::http_error(r1) [1] FALSE > httr::http_status(r1) $category [1] "Success" $reason [1] "OK" $message [1] "Success: (200) OK" and > httr::h

Re: [R] httr::content without message

2018-01-02 Thread Roy Mendelssohn - NOAA Federal
Thanks to all that replied. I had just looked through the httr code and sure enough for a .csv mime time it calls readr::read_csv(). The httr::content docs suggest not using automatic parsing in a package, rather to determine mime type and parse yourself and Ben's suggestion also works if I d

Re: [R] httr::content without message

2018-01-02 Thread William Dunlap via R-help
You can suppress all messages from that command with junk <- suppressMessages(httr::content(r1)) If you only want to suppress that specific message you can use withCallingHandlers: junk <- withCallingHandlers( httr::content(r1), message=function(e){ if (grepl("P

Re: [R] httr::content without message

2018-01-02 Thread Ben Tupper
Ahoy! That's a message generated by the readr::read_table() function (or it's friends). You can suppress it a number of ways, but this should work as httr::content() will pass through arguments, like col_types = cols(), to the file reader. junk <- httr::content(r1, col_types = cols()) See mo

Re: [R] httr::content without message

2018-01-02 Thread David Winsemius
> On Jan 2, 2018, at 9:30 AM, Roy Mendelssohn - NOAA Federal > wrote: > > Hi All: > > I am using httr to download files form a service, in this case a .csv file. > When I use httr::content on the result, I get a message. Since this will be > in a package. I want to suppress the message,

[R] httr::content without message

2018-01-02 Thread Roy Mendelssohn - NOAA Federal
Hi All: I am using httr to download files form a service, in this case a .csv file. When I use httr::content on the result, I get a message. Since this will be in a package. I want to suppress the message, but haven't figured out how to do so. The following should reproduce the result: m

Re: [R] Discrete valued time series data sets.

2018-01-02 Thread Eric Berger
Hi Rolf, I looked at https://docs.microsoft.com/en-us/azure/sql-database/sql-database-public-data-sets One of the first sets in the list is the airline time series (I think it is also used in dplyr examples). https://www.transtats.bts.gov/OT_Delay/OT_DelayCause1.asp You might find other possibil