Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commands and packages in R language

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "what commands and packages are there in R language". In the operation of practical cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Since I started to learn R, I have been finding the R bag of "too late to meet".

Analysis and modeling:

Matrix package: advanced sparse matrix processing, do not understand the concept of sparse matrix memory footprint and running speed can not bear to look directly.

Reshape2/ddply: don't worry about data processing.

* apply series: functions that are easier to use than for, in which tapply is far less popular than lapply, but not as useful as it. In fact, whether the lapply becomes faster depends on the individual implementation, because although lapply calls the C implementation, it still has to go back to call the user-defined function in R to do the calculation. The speed of this function is the key.

Compiler package: even if there is for in the code, it can be accelerated.

Foreach: general parallel interface, cross-platform multi-function.

Lubridate: do not ask for help in the format of processing time and date.

Gbm: the effect is similar to that of randomForest, but it takes up very little memory and supports multicore CrossValidation operations.

Stats::optim (): the stupidest choice to make optimization. If you don't believe in this three lines of R code to make SVM:weibo.com/1459604443/A3, it doesn't matter if you don't understand Newton method.

Reporting and visualization:

Knitr/slidify:knitr is the masterpiece of @ Xie Yihui. So easy for presentations and slides, but the authors of slidify don't like writing documents, so they have a headache.

Shiny: use R to generate Web App, and the backend has a strong unified interface. For example: hetong.shinyapps.io/img.

Recharts: generate interactive graphics quickly and easily in R without having to switch from R to js anymore.

Other:

Devtools::install_github (): free from the CRAN power, Github makes the world a better place.

Base::match (): in many cases, it is higher than which,is.element.

Utils::read.table (): setting nrows can allocate memory in advance, while setting comment.char= "" and colClasses can speed up reading.

OpenBLAS library: although it is not an R package, the acceleration of matrix operations on multicore CPU is so convenient and obvious, and it is easy to install on Ubuntu, and there is no need to recompile R.

Define startup items: if the stringsAsFactors always defaults to TRUE deep pain aversion, you can modify the Rprofile.site file, plus a command that runs automatically every time you start. @ Ren Kun mentioned in the comments: defining startup items is dangerous, if you don't pay attention, it will cause problems with the portability of the code. Put it on someone else's computer and find all kinds of factor.

Upgrade R package: after the version of R is changed, you can copy the old R package to the new version of library directory, and then run update.packages (checkBuilt=TRUE, ask=FALSE). This is the official hint. Put it in FAQ. I don't know how many people have noticed: R for Windows FAQ.

This is the end of the content of "what commands and packages are in R language". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report