In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What this article shares to you is about the introduction of R language and the method of descriptive statistical analysis. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it with the editor.
Today, I'm going to talk about R language, which is mainly about the basic and simple statistical analysis.
R language is actually the first language that I officially come into contact with the programming language. I learned in college that I was so full of water in MATLAB. So when I first started learning R, I was in pain, you know. After about a month of running-in period, gradually have a little understanding of R, know how to learn, what things, of course, at the beginning is still looking for du Niang, what to read, how to install abc and so on. Like the introductory books that most people learn, I also started with the book "R language practice", but now it seems that I only need to read the first seven chapters of this book, because the latter involves the content of specific models, if you do not have a specific practical problem to solve, it is of little use to learn, after all, we are not for the exam. All right, let's talk so much first, let's get down to business.
# how to use R
# # installation
Windows
Download address:
Https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/
Windows installation is relatively simple, .exe files, basically next on the ok.
What needs to be said is that sometimes when we need to use a certain package, R reports that the current R version is not supported. At this time, we need to install the older R version. Here we give an old version of R link, which version you need can be downloaded directly.
Https://cran.r-project.org/bin/windows/base/old/
There is another problem, that is, how to update R, the latest version of R is 3.4.1. So when the next version comes out, how to update it. The stupidest way is to download the new version and uninstall the old one. But when you use R for a period of time, it is inevitable to install a lot of packages,R installation packages is not big, but with packages, the total is very large, I remember the most time, I installed hundreds of packages. A trick to teach you here is to copy out and save the library folder in the R installation directory before uninstalling R, and then copy the files to the newly installed library folder after installing the new version of R. In general, in windows, the installation directory for R defaults to:
C:\ ProgramFiles\ R\ R Murray 3.4.0\ library
Then how to install it in Ubuntu, you can also refer to the documentation:
Https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/linux/ubuntu/README.html
Execute the following three commands in turn, and then ok.
Sudo apt-get update
Sudo apt-get install r-base
Sudo apt-get install r-base-dev
Then, after installing R in Ubuntu, type R directly into shell, and you will enter the R environment, but it is tiring to write code like this, so it is recommended that you use Sublim Text as the IDE in R's Ubuntu. Setting up the environment is also very simple, mainly to install the expansion package SublimeREPL, in the sublim shortcut key Ctrl+shift+P type install, will come out install package, and then type SublimeREPL can be installed. After the installation, after the
Preferences > Package Settings > SublimeREPL > Settings-User
Enter the following:
{
"default_extend_env": {"PATH": "{PATH}; write your installation directory here"}
"show_transferred_text": true
}
There is another tool that can be used in windows, that is, the IDE of R, compared to the number of IDE in Python, the more useful IDE is Rstudio. Just download and install it directly
Address: https://www.rstudio.com/products/rstudio/download/
With regard to the use of Rstudio, I just want to talk about the problem of how to set up the compiler of R. Choice
Tools- > Global options
It is critical that you can choose different R versions, especially for R users who have different versions of R installed. Of course, if you only install one version of R, you don't need to set it up. Rstudio will automatically set it up for us when you install it.
OK, everything else can be left alone. The environment will be set up here.
Then for starters, the basic R concepts, variables, and data structures will not be discussed today. Let's talk about several methods of descriptive statistical analysis in R. What is descriptive statistical analysis? To put it simply, the sample statistics are calculated according to the samples. Such as mean, maximum, minimum, variance, quantile, skewness, bee degree and so on. Then through examples, you can also get a general idea of some of the usage and features of the R language.
Single-line comments in R are represented by #, multiline comments are not supported, and if you want multiline comments, you can only use multiple #. Another thing to say is that the shortcut key for multiline comments in Rstudio is Ctrl+Shift+C, and uncommenting is also Ctrl+Shift+C. On the keyboard keys, we strongly recommend that you go to Baidu, remember the commonly used, can improve efficiency.
# set R working directory, setwd
Setwd ("F:/R_learn/")
The reason why # R is so powerful is that R has a lot of packages
# these Packages provide us with very convenient tools. So first of all,
# learn how to install packages. Use the following command, which is equivalent to Python's pip install.
Install.packages ("psych")
# after it is installed, it needs to be loaded, which is equivalent to the import of Python.
Library (psych)
# read csv file, R
Test_data
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.