R mclapply cores option
This morning, I found the default behavior of the mclapply() function not quite different from the one of the lapply(). After quick investigation, I found is was due to an option not correctly set: the number of core to use.
> getOption("cores")
NULL
I must then overwrite the default mc.cores option of the mclapply()
R read lists from file
[caption id="" align="alignright" width="350"]
Doubly-linked list (Photo credit: Wikipedia)[/caption]
This a retranscription of a post on stackoverflow.
The solution I keep is using the following command
a <- strsplit(scan("data.txt", what="", sep="n"), "t")
Read More
SQL like aggregation in R
[caption id="" align="alignright" width="75"]
Group by (Photo credit: Wikipedia)[/caption]
The
use case is similar to the one descibe in usual
SQL quick reference guide at the "group by" section.
first of all, I need a dataset as one data.frame:
d <- data.frame(product=sample(c("fruit …
Read More
evaluation of exploration values
For some application, it is usefull to evaluate some physical value over a grid. For each dimension of the grid, the order of magnitude to use is not obvious.Watch movie online The Transporter Refueled (2015)
grid evaluation
the function …
Read More
evaluation of exploration values
For some application, it is usefull to evaluate some physical value over a grid. For each dimension of the grid, the order of magnitude to use is not obvious.Watch movie online The Transporter Refueled (2015)
grid evaluation
the function …
Read More
unfactor R factor
Consider the following R code:
a <- factor(floor(rnorm(100))) class(a) summary(a)
Why should you have that? great question. Maybe because of memory
place. I really don’t know, but I received some R dataset in the form
of a factor. My problem is to revert this process …
Read More
languages popularity
I found a study from
IEEE
on popularity of programming languages. I note:
- The languages I use are in the top 10 (
R , C)
- C is always use in many
- scripts languages are widly used (you can find a shell or a python
inerpreter …
Read More
languages popularity
I found a study from
IEEE
on popularity of programming languages. I note:
- The languages I use are in the top 10 (
R , C)
- C is always use in many
- scripts languages are widly used (you can find a shell or a python
inerpreter …
Read More
R convert IPv4 adresses to binary
I want to retrieve the binary representation (as a string of 0 and 1) of
an IPv4 address ( human
readable string
representation) using only R functions.
The following steps and functions can be used:
step |
tool |
separate each octet |
strsplit(x, split=”[.]”) |
convert integer to … |
Read More
quick pcap transformation
As many people working with network protocol, I use pcap library and write C code to manipulate packets. After several days testing my library on pcap file, I found that the traffic on which I have to run my program is encapsulated in …
Read More