Re: [R] Interesting quirk with fractions and rounding

2017-04-20 Thread PIKAL Petr
Hi The problem is that people using Excel or probably other such spreadsheets do not encounter this behaviour as Excel silently rounds all your calculations and makes approximate comparison without telling it does so. Therefore most people usually do not have any knowledge of floating point num

Re: [R] Interesting quirk with fractions and rounding

2017-04-20 Thread Hervé Pagès
Also note that we see the same thing in Ruby: irb(main):001:0> 100*(23/40) => 0 irb(main):002:0> 100.0*(23.0/40.0) => 57.49 irb(main):003:0> (100.0*23.0)/40.0 => 57.5 and in C: hpages@latitude:~$ cat test.c #include main() { printf("%.15f\n", 100.0 * (23.0 / 4

Re: [R] Interesting quirk with fractions and rounding

2017-04-20 Thread William Dunlap via R-help
Use all.equal(tolerance=0, aa, bb) to check for exact equality: > aa <- 100*(23/40) > bb <- (100*23)/40 > all.equal(aa,bb) [1] TRUE > all.equal(aa,bb,tolerance=0) [1] "Mean relative difference: 1.235726e-16" > aa < bb [1] TRUE The numbers there are rounded to 52 binary dig

Re: [R] rdb and rds files include abolute file paths / help understanding how lazy-load dbs are created

2017-04-20 Thread Jeff Newmiller
I don't think this is on topic either here or on R-package-devel... it should go back to R-devel of you can provide a compelling argument for making the change. That said, I still feel you are chasing a non-problem. The original directories generally don't even exist on the original computer a

Re: [R] rdb and rds files include abolute file paths / help understanding how lazy-load dbs are created

2017-04-20 Thread David Winsemius
I would have thunk that the right list would be https://stat.ethz.ch/mailman/listinfo/r-package-devel Best David Sent from my iPhone > On Apr 19, 2017, at 3:40 PM, Philip Rinn wrote: > > Hi, > >> On 12.04.2017 at 08:09, Jeff Newmiller wrote: >> >> Someone might respond here anyway, but I t

Re: [R] Looking for a package to replace xtable

2017-04-20 Thread Jeff Newmiller
Since you are generating html you can use html syntax. You might also be interested in the ReportR package. -- Sent from my phone. Please excuse my brevity. On April 20, 2017 2:30:43 PM PDT, BR_email wrote: >David: >All is perfect, almost - after I ran your corrections. >Is there a way I can h

Re: [R] Interesting quirk with fractions and rounding

2017-04-20 Thread Michael Hannon
I might add that things that *look* like integers in R are not really integers, unless you explicitly label them as such: > str(20) num 20 > str(20.5) num 20.5 > str(20L) int 20 > I think that Python 2 will do integer arithmetic on things that look like integers: $ python2 . . . >>> 30 / 20

Re: [R] Interesting quirk with fractions and rounding

2017-04-20 Thread Nordlund, Dan (DSHS/RDA)
This is FAQ 7.31. It is not a bug, it is the unavoidable problem of accurately representing floating point numbers with a finite number of bits of precision. Look at the following: > a <- 100*(23/40) > b <- (100*23)/40 > print(a,digits=20) [1] 57.493 > print(b,digits=20) [1] 57.5 >

[R] Interesting quirk with fractions and rounding

2017-04-20 Thread Paul Johnson
Hello, R friends My student unearthed this quirk that might interest you. I wondered if this might be a bug in the R interpreter. If not a bug, it certainly stands as a good example of the dangers of floating point numbers in computing. What do you think? > 100*(23/40) [1] 57.5 > (100*23)/40 [1

Re: [R] Looking for a package to replace xtable

2017-04-20 Thread BR_email
David: All is perfect, almost - after I ran your corrections. Is there a way I can have more control of the column names, i.e., not be restricted to abbreviations headings, and center-justify? Thanks a lot, nice. Bruce David L Carlson wrote: #1 You can remove the rownames by adding the argu

Re: [R] Looking for a package to replace xtable

2017-04-20 Thread Bruce Ratner PhD
David: Thanks so much. I will recode and let you know how it works out. Bruce __ Bruce Ratner PhD The Significant Statistician™ (516) 791-3544 Statistical Predictive Analytics -- www.DMSTAT1.com Machine-Learning Data Mining -- www.GenIQ.net > On Apr 20, 2017, at 4:31 PM, David L Ca

Re: [R] Looking for a package to replace xtable

2017-04-20 Thread David L Carlson
#1 You can remove the rownames by adding the argument include.rownames=FALSE to print.xtable(): print.xtable(DECILE_TABLE, type="html",file="DecileTable.html", include.rownames=FALSE) #2 Prevent data.frame from converting the first column to a factor and use NAs for the columns where you don't

Re: [R] Looking for a package to replace xtable

2017-04-20 Thread Bruce Ratner PhD
Duncan: Thanks. I've exhausted my search for a simple table package that also allows for column sums. If you are not familiar with the decile table, you will find it quite embedded with much insight for predominance of virtually any model. Regards, Bruce __ Bruce Ratner PhD The Sig

Re: [R] Looking for a package to replace xtable

2017-04-20 Thread Duncan Murdoch
On 20/04/2017 1:09 PM, BR_email wrote: R-helper: Below, code for generating a decile table. I am using the xtable package, but it is not quite right for the output. Issue #1. xtable inserts an unwanted column, before the first derived column DECILE Issue #2. In the last line "Total" I manually su

[R] Looking for a package to replace xtable

2017-04-20 Thread BR_email
R-helper: Below, code for generating a decile table. I am using the xtable package, but it is not quite right for the output. Issue #1. xtable inserts an unwanted column, before the first derived column DECILE Issue #2. In the last line "Total" I manually sum all columns, even though I only want

Re: [R] S4 vs S3

2017-04-20 Thread Jeff Newmiller
A simple explanation inevitably omits information. Whether the omitted information would have been useful to you is something only you can judge, which means you end up having to review the details anyway. Hadley Wickham's Advanced R is worth Googling, and don't forget to RTFM. In a nutshell, S

Re: [R] by function error

2017-04-20 Thread PIKAL Petr
Hi The problem is in your function, not in by. > dstats(mtcars[,c('mpg', 'hp')]) Error in is.data.frame(x) : (list) object cannot be coerced to type 'double' In addition: Warning message: In mean.default(x) : argument is not numeric or logical: returning NA > Your function expects vector but y

[R] warning.expression?

2017-04-20 Thread Cole Arendt
> It seems a bit dumb that warning.expression functions can only say > "Hey, something a bit iffy may have ocurred, but I dont know what and I > dont know where!". Maybe there's something in that cptr->cloenv that can > tell you... The way that I intend to begin using this is with non-standar

[R] S4 vs S3

2017-04-20 Thread Balal Ezanloo
Hi can any one explain the difference between s4 and s3 classes in R in a simple way? __ 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 http://www.R-project.

[R] by function error

2017-04-20 Thread ??????
hi, I practice R programing by the step in <>; when i test by function, i get error like these; call for help! dstats <- function(x){c(mean=mean(x), sd=sd(x))} > by(mtcars[,c('mpg', 'hp')], mtcars$am, dstats) Show Traceback Rerun with Debug Error in is.data.frame(x) : (list) object canno

Re: [R] rdb and rds files include abolute file paths / help understanding how lazy-load dbs are created

2017-04-20 Thread Philip Rinn
Hi, Am 20.04.2017 um 00:32 schrieb Jeff Newmiller: > I think we are (I certainly am) going to need a more concrete example. As in, > point us at a specific package and filename in this package that illustrates > your concern. Such precision would also be expected on R-devel, so the lack of > respo

Re: [R] rdb and rds files include abolute file paths / help understanding how lazy-load dbs are created

2017-04-20 Thread Philip Rinn
Hi, On 12.04.2017 at 08:09, Jeff Newmiller wrote: > Someone might respond here anyway, but I think this is more of an R-devel > question. I tired R-devel before[1] with no response :(. > Anyway, as long as the package file after installation has appropriate file > names for where it is installe

[R] Time Series forecasting models for irregular time series for zoo objects

2017-04-20 Thread Sonam Tripathi
Hi I am new with R.Currently I am using time series forecasting to do daily forecasting for predicting request per day.The dataset which i am using has unevenly spaced date a snapshot of dataset is given below I have to find the best model which can help me in predicting the future request which

Re: [R] Multiple Histograms in R

2017-04-20 Thread Ulrik Stervbo
Hi Prateek, maybe facet_* with ggplot is what you are looking for HTH Ulrik On Thu, 20 Apr 2017 at 13:24 prateek pande wrote: > HI Hasan, > > Thanks for sharing the solution. Really appreciate it. > > But i was reading somewhere that we cannot use par with ggplot 2 . we can > only use grid ext

Re: [R] Multiple Histograms in R

2017-04-20 Thread prateek pande
HI Hasan, Thanks for sharing the solution. Really appreciate it. But i was reading somewhere that we cannot use par with ggplot 2 . we can only use grid extra to have multiple plots in a single view. Is it right? Regards Prateek On Thu, Apr 20, 2017 at 10:47 AM, Hasan Diwan wrote: > Prateek,