The basic of using R program
Number 1 is the blank. It use for typing code and run code(ctrl+enter)
Number 2 is the environment and history.For example,
It show the data that you type. When you type only name such as david, the data will know the value of david = 60.
Number 3, It show the result when you run code in the blank (number 1).
and number 4, It show files,plot,packages,help and viewer. For example, when you type "?sd" , number 4 show meaning of sd in "help".
Other sample in program R.
In R program has a lot of displays of data, one of formation of showing the data is " iris".
You can call Iris which is the database.
You can calculate the average,sd,max,min and variance in Iris formation. After that, you run code.
It will show the results.
And then, if you want to understand more than numerics, you can plot graph. It's so easy. Just type the code. For example,
When you run code, it show the result quickly.
Or you want to show the data in other formation such as histogram. You will type hist( ).
For instance, hist(cars_data$sq_hp) <--- Drawing histogram between the data of sq and hp.
R program can find the correlation between the variables.
You have to fix the topic which you want to find the correlation such as mtcars.
You have to type "head(mtcars)". And then, when you run code, r program will show the data mtcars automatically.
But you want to find the correlation of mtcars, you have to use each variables of mtcars. You has to call it. Just type "names(mtcars)".
And then, you will find the correlation whatever you want.
You will type two variables that you want to find the correlation. And then, you will run code.
Or you want to find the correlation of every variables in mtcars. You just type "cor(mtcars)".
Finally, This is the examples using in R program.
ไม่มีความคิดเห็น:
แสดงความคิดเห็น