[R] A better scales::dollar() ?

2019-12-06 Thread POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help
I'm writing a quite large document in Rmarkdown which has financial data in it. I format that data using scales::dollar() currently something like this: > > require (scales) > x = 10 > cat (dollar (x, prefix ="£", big.mark=",")) £100,000 But actually, I'd quite like to get £100k out in tha

Re: [R] I can't get seq to behave how I think it should

2019-01-17 Thread POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help
for > > findInterval() > > > > > lut = seq(1.4, 2.1, by=0.001) > > > findInterval(1.8, lut) > > [1] 401 > > > > findInterval() uses a rapid search to find the index in the look up > > table (lut) that is just less than or equal to the search

Re: [R] I can't get seq to behave how I think it should

2019-01-17 Thread POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help
alue (in your > example 1.8). > > Cheers, > Ben > > > On Jan 17, 2019, at 8:33 AM, POLWART, Calum (COUNTY DURHAM AND > DARLINGTON NHS FOUNDATION TRUST) via R-help > wrote: > > > > I am using seq with the expression seq(1.4, 2.1, by=0.001) to create > > a seq

[R] I can't get seq to behave how I think it should

2019-01-17 Thread POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help
I am using seq with the expression seq(1.4, 2.1, by=0.001) to create a sequence of references from 1.4 to 2.1 in 0.001 increments. They appear to be created correctly. They have a related pair of data which for the purposes of this we will call val. I'm interested in the content on the row wi

[R] odfWeave - A loop of the "same" data

2017-06-01 Thread POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help
Before I go and do this another way - can I check if anyone has a way of looping through data in odfWeave (or possibly sweave) to do a repeating analysis on subsets of data? For simplicity lets use mtcars dataset in R to explain. Dataset looks like this: > mtcars mpg cyl disp