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.
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")
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 …
evaluation of exploration values
Evaluation of occupation type over a grid (Photo credit: Wikipedia)
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)
the function …
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 …
R read.table and special characters
[caption id="" align="alignright" width="350"] read.on.table (Photo credit: Wikipedia)[/caption]
R convert IPv4 adresses to binary
binary conversion (Photo credit: Wikipedia)
I want to retrieve the binary representation (as a string of 0 and 1) of
an IPv4 address ( human
representation) using only R functions.
The following steps and functions can be used:
|separate each octet
|convert integer to …|
[R R R R R R R R R R R R R R R]
[caption id="" align="alignright" width="350"] Spools of thread (Photo credit: Wikipedia)[/caption]
I wanted to use multithreading in R. I'm used to C pthread mechanism, but I want to use some R functions. This functions run independently on separate data, and treatments can take some time.
In short, what …