How should I deal with “package ‘xxx’ is not available (for R version x.y.z)” warning?

I tried to install a package, using install.packages(“foobarbaz”) but received the warning Warning message: package ‘foobarbaz’ is not available (for R version x.y.z) Why doesn’t R think that the package is available? See also these questions referring to specific instances of this problem: My package doesn’t work for R 2.15.2 package ‘Rbbg’ is not available … Read more

How to convert a factor to integer\numeric without loss of information?

When I convert a factor to a numeric or integer, I get the underlying level codes, not the values as numbers. f <- factor(sample(runif(5), 20, replace = TRUE)) ## [1] 0.0248644019011408 0.0248644019011408 0.179684827337041 ## [4] 0.0284090070053935 0.363644931698218 0.363644931698218 ## [7] 0.179684827337041 0.249704354675487 0.249704354675487 ## [10] 0.0248644019011408 0.249704354675487 0.0284090070053935 ## [13] 0.179684827337041 0.0248644019011408 0.179684827337041 ## [16] … Read more

data.table vs dplyr: can one do something well the other can’t or does poorly?

Overview I’m relatively familiar with data.table, not so much with dplyr. I’ve read through some dplyr vignettes and examples that have popped up on SO, and so far my conclusions are that: data.table and dplyr are comparable in speed, except when there are many (i.e. >10-100K) groups, and in some other circumstances (see benchmarks below) … Read more