Data.table rocks! Data manipulation the fast way in R
I really should make it a habit of using
Here is a simple example: I have a data frame showing incremental claims development by line of business and origin year. Now I would like add a column with the cumulative claims position for each line of business and each origin year along the development years.
It's one line with
And it is getting even better. Suppose you want to get the latest claims development position for each line of business and origin year. Again, it is only one line:
data.table. The speed and simplicity of this R package are astonishing. Here is a simple example: I have a data frame showing incremental claims development by line of business and origin year. Now I would like add a column with the cumulative claims position for each line of business and each origin year along the development years.
It's one line with
data.table! Here it is:myData[order(dev), cvalue:=cumsum(value), by=list(origin, lob)]It is even easy to read! Notice also that I don't have to copy the data. The operator ':=' works by reference and is one of the reasons why data.table is so fast.And it is getting even better. Suppose you want to get the latest claims development position for each line of business and origin year. Again, it is only one line:
27 Nov 2012
07:42
data.table
,
Insurance
,
R
,
Tutorials
Claims reserving in R: ChainLadder 0.1.5-4 released
Last week we released version 0.1.5-4 of the
The chain-ladder method which is a popular method in the insurance industry to forecast future claims payments gave the package its name. However, the
Since we published version 0.1.5-2 in March 2012 additional functionality has been added to the package, see the change log, but in particular the vignette has come a long way.
Many thanks to my co-authors Dan Murphy and Wayne Zhang.
ChainLadder package on CRAN. The R package provides methods which are typically used in insurance claims reserving. If you are new to R or insurance check out my recent talk on Using R in Insurance.The chain-ladder method which is a popular method in the insurance industry to forecast future claims payments gave the package its name. However, the
ChainLadder package has many other reserving methods and models implemented as well, such as the bootstrap model demonstrated below. It is a great starting point to learn more about stochastic reserving.Since we published version 0.1.5-2 in March 2012 additional functionality has been added to the package, see the change log, but in particular the vignette has come a long way.
Many thanks to my co-authors Dan Murphy and Wayne Zhang.
20 Nov 2012
19:32
Actuarial
,
ChainLadder
,
Insurance
,
News
,
R
,
reserving
,
stochastic reserving
,
vignette
Simulating neurons or how to solve delay differential equations in R
I discussed earlier how the action potential of a neuron can be modelled via the Hodgkin-Huxely equations. Here I will present a simple model that describes how action potentials can be generated and propagated across neurons. The tricky bit here is that I use delay differential equations (DDE) to take into account the propagation time of the signal across the network.
My model is based on the paper: Epileptiform activity in a neocortical network: a mathematical model by F. Giannakopoulos, U. Bihler, C. Hauptmann and H. J. Luhmann. The article presents a flexible and efficient modelling framework for:
My model is based on the paper: Epileptiform activity in a neocortical network: a mathematical model by F. Giannakopoulos, U. Bihler, C. Hauptmann and H. J. Luhmann. The article presents a flexible and efficient modelling framework for:
- large populations with arbitrary geometry
- different synaptic connections with individual dynamic characteristics
- cell specific axonal dynamics
13 Nov 2012
07:25
bursting
,
dede
,
delay differential equations
,
deSolve
,
Dynamical Systems
,
FitzHugh-Nagumo
,
Hodgkin-Huxley
,
Hopf-Bifurcation
,
neuron
,
R
,
Tutorials
Time for an old classic game: Moon-buggy
I discovered an old classic game of mine again: Moon-buggy by Jochen Voss, based on the even older Moon Patrol, which celebrates its 30th birthday his year.
6 Nov 2012
07:16
game
,
moon-buggy
,
Soapbox
googleVis 0.3.3 is released and on its way to CRAN
I am very grateful to all who provided feedback over the last two weeks and tested the previous versions 0.3.1 and 0.3.2, which were not released on CRAN.
Not much, but
As usual, you can download the most recent version from our project site. It will take a few days before version 0.3.3 will be available on CRAN for all operating systems.
So, what changed since version 0.3.2?
Not much, but
plot.gvis didn't open a browser window when options(gvis.plot.tag) were not set to NULL, but the user explicitly called plot.gvis with tag NULL. Thanks to Sebastian Kranz for reporting this bug. Additionally the vignette has been updated and includes an extended section on knitr. As usual, you can download the most recent version from our project site. It will take a few days before version 0.3.3 will be available on CRAN for all operating systems.
googleVis 0.3.2 is released: Better integration with knitr
After last week's kerfuffle I hope the roll out of googleVis version 0.3.2 will be smooth. To test the water I release this version into the wild here and if it doesn't get shot down in the next days, then I shall try to upload it to CRAN. I am mindful of the CRAN policy, so please get in touch or add comments below if you find any show stoppers.
Now this doesn't sound too exciting but it can be tremendously helpful when you write Markdown files for
So what's new in googleVis 0.3.2?
The default behaviour of the functionsprint.gvis and plot.gvis can be set via options(). Now this doesn't sound too exciting but it can be tremendously helpful when you write Markdown files for
knitr. Here is why:googleVis 0.3.0/0.3.1 is released: It's faster!
Version 0.3.0 of the googleVis package for R has been released on CRAN on 20 October 2012. With this version we have been able to speed up the code considerably. The transformation of R data frames into JSON works significantly faster. The execution of the
Further, the plot function Unfortunately this caused an error message under RStudio and RGui on Windows. The argument has been removed again and
gvisMotionChart function in the World Bank demo is over 35 times faster. Thanks to ideas by Wei Luo and in particular to Sebastian Kranz for providing the code.plot.gvis has gained a new argument 'browser'. This argument is passed on to the function browseURL. The 'browser' argument is by default set to the output of getOption("browser") in an interactive session, otherwise to 'false'. This prevents R CMD CHECK trying to open browser windows during the package checking process.plot.gvis handles the check if R is running interactively internally. The bug has been fixed in googleVis-0.3.1, not yet available on CRAN, but on our project download page. Thanks to Henrik Bengtsson and Sebastian Kranz for their comments, suggestions and quick response.
