日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

r语言 分类变量 虚拟变量_R语言中的变量

發(fā)布時間:2023/12/1 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 r语言 分类变量 虚拟变量_R语言中的变量 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

r語言 分類變量 虛擬變量

R語言| 變數(shù) (R Language | Variables)

In the previous tutorial, we have come across the basic information that stands as a pavement for understanding the R language in depth. Now moving future let us educate ourselves about the concept of Variables that are used in the R language.

在上一教程中,我們了解了一些基本信息,它們是深入理解R語言的基礎(chǔ)。 現(xiàn)在,展望未來,讓我們對R語言中使用的變量的概念進行自我教育。

Variables are the storage places in the R language: They stay responsible for creating a memory for storing the data after they are created. The variables are so powerful that if they are changed then the result of the program will change. That means the variables are the components in the R language in which they have the capability of manipulating the program whatever we have written.

變量是R語言的存儲位置變量創(chuàng)建后,仍負責創(chuàng)建用于存儲數(shù)據(jù)的內(nèi)存。 變量是如此強大,以至于如果改變了它們,那么程序的結(jié)果將會改變。 這意味著變量是R語言中的組成部分,它們具有操縱我們所編寫程序的能力。

變量中存儲了什么? (What are stored in a variable?)

Every one of us is acquainted with the fact that the variables in the other programming languages also work on the same principle as that in the R language. In simple terms, we can confess that the variables act like the containers that store the data which is given by the user.

我們每個人都熟悉這樣的事實,即其他編程語言中的變量也按照與R語言相同的原理工作。 簡單來說,我們可以承認變量的作用類似于存儲用戶提供的數(shù)據(jù)的容器。

The variables in the R language are capable enough to store the atomic vector or a group of atomic vectors in them. In addition to that, they can also reserve R objects.

R語言中的變量足以存儲原子向量或一組原子向量。 除此之外,它們還可以保留R對象。

Syntax followed to declare a variable in the r language:

遵循語法以r語言聲明變量:

A variable name that exists to be valid should consist of numbers, letters, or dots. In addition to that one can also use the underline characters while giving a name to the variable.

存在的有效變量名應(yīng)該由數(shù)字,字母或點組成。 除此以外,還可以在給變量命名的同時使用下劃線字符。

But there is a strict rule in the R language which speaks about the concept I how to give a perfect name to the variable as per the conventions provided by the seniors. Whatever the name the user assigns for the variable but the name of the variable must start with a letter which should not be followed by a number. Also one can give a name with a dot at first followed by other letters.

但是R語言中有一個嚴格的規(guī)則,該規(guī)則涉及有關(guān)如何按照老年人提供的約定為變量賦予完美名稱的概念。 用戶為變量分配的名稱是什么,但變量的名稱必須以字母開頭,字母后不能跟數(shù)字。 也可以先給一個名字加一個點,然后再加上其他字母。

Examples:

例子:

var_name2 : validvar_name% : invalid2var_name : invalid_variable_name: invalid

變量分配 (Variable Assignment)

The general convention followed for assigning the values to the variables is by making the use of rightward, leftward, or the equal to operator. Furthermore, the value stored in ten variables can be displayed over the screen with the help of the below functions:

將值分配給變量的通用約定是使用向右,向左或等于運算符。 此外,借助以下功能,可以將十個變量中存儲的值顯示在屏幕上:

  • print()

    打印()

  • cat()

    貓()

The cat() function in the R language plays an important role in the process of combining various items as a part of the same or continuous output in the printing phase.

R語言中的cat()函數(shù)在將各種項目組合為打印階段中相同或連續(xù)輸出的一部分的過程中起著重要作用。

# Assignment using equal operator. var.1 = c(0,1,2,3) # Assignment using leftward operator. var.2 <- c("learn","R") # Assignment using rightward operator. c(TRUE,1) -> var.3 print(var.1) cat ("var.1 is ", var.1 ,"\n") cat ("var.2 is ", var.2 ,"\n") cat ("var.3 is ", var.3 ,"\n")

The above is the code that represents the concept of assigning the variable in the R language.

上面的代碼代表了用R語言分配變量的概念。

Output

輸出量

[1] 0 1 2 3 var.1 is 0 1 2 3 var.2 is learn R var.3 is 1 1

翻譯自: https://www.includehelp.com/r/variables-in-the-r-language.aspx

r語言 分類變量 虛擬變量

總結(jié)

以上是生活随笔為你收集整理的r语言 分类变量 虚拟变量_R语言中的变量的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。