r語言 分類變量 虛擬變量_R語言中的變量

r語言 分類變量 虛擬變量

R語言| 變數 (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語言的基礎。 現在,展望未來,讓我們對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語言的存儲位置變量創建后,仍負責創建用于存儲數據的內存。 變量是如此強大,以至于如果改變了它們,那么程序的結果將會改變。 這意味著變量是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語言相同的原理工作。 簡單來說,我們可以承認變量的作用類似于存儲用戶提供的數據的容器。

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.

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

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

Examples:

例子:

    var_name2 :     valid
var_name% :     invalid
2var_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()函數在將各種項目組合為打印階段中相同或連續輸出的一部分的過程中起著重要作用。

# 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語言 分類變量 虛擬變量

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377330.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377330.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377330.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

算法題復習(快排、鏈表、二分、哈希、雙指針)

目錄1、快速排序復習2、鏈表部分復習203. 移除鏈表元素707. 設計鏈表206. 反轉鏈表142.環形鏈表 II3、二分法復習4、哈希法復習5、雙指針復習**15. 三數之和****18. 四數之和****27. 移除元素****344. 反轉字符串**,簡單&#xff0c;雙指針從兩側往中間靠攏&#xff0c;并隨時s…

Cassandra1.2文檔學習(7)—— 規劃集群部署

數據參考&#xff1a;http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/architecture/architecturePlanningAbout_c.html 當規劃一個Cassandra集群部署時&#xff0c;關于你初始存儲的數據的數據量你應當有一個好的想法&#xff0c;并且對于…

虛擬機設置NAT

需要開啟虛擬機網絡相關服務&#xff0c; 安裝虛擬網卡&#xff0c; 還有必須安裝 VMware ToolsVMware虛擬機下實現NAT方式上網1. 把你的虛擬網卡VMnet8設置為自動獲得IP、自動獲得DNS服務器&#xff0c;啟用。2. 把你虛擬機中操作系統的“本地連接”也設置為自動獲得IP、自動獲…

窗體震動 C# (不使用Timer控件,控制窗體震動)

private static Point plocation new Point(); public static void StartVibration(Form form)//Form 傳入需要振動的窗體 { plocation form.Location; for (int i 1; i < 41; i)//41&#xff0c;可以理解為震動的時間。…

算法題復習(棧與隊列、二叉樹)

目錄棧與隊列棧用于匹配的問題隊列用于堆二叉樹系列深度遍歷&#xff0c;遞歸與迭代層序遍歷二叉樹屬性二叉樹修改與構造二叉搜索樹公共祖先二叉搜索樹的修改與構造棧與隊列 棧用于匹配的問題 20. 有效的括號 https://leetcode-cn.com/problems/valid-parentheses/ 不匹配的三…

bpsk_BPSK的完整形式是什么?

bpskBPSK&#xff1a;二進制相移鍵控 (BPSK: Binary Phase Shift Keying) BPSK is an abbreviation of "Binary Phase Shift Keying". BPSK是“二進制相移鍵控”的縮寫 。 BPSK is also occasionally called phase reversal keying (PRK), or 2PSK, which is the el…

win7 下安裝oracle 10g

oracle 10g 在win7下安裝&#xff0c;提示程序異常終止&#xff0c;發生未知錯誤 在網上搜結果&#xff1a; 修改Oracle 10G\database\stage\prereq\db\refhost.xml 在 </SYSTEM> <CERTIFIED_SYSTEMS>后面添加 <!--Microsoft Windows 7--> <OPERAT…

poj 1703 Find them, Catch them

題目鏈接&#xff1a;http://poj.org/problem?id1703 題目大意&#xff1a;警察抓獲N個罪犯&#xff0c;這些罪犯只可能屬于兩個團伙中的一個&#xff0c;現在給出M個條件&#xff08;D a b表示a和b不在同一團伙&#xff09;&#xff0c;對于每一個詢問(A a b)確定a&#xff0…

雙向a*搜索算法_雙向搜索算法

雙向a*搜索算法什么是雙音搜索&#xff1f; (What is bitonic search?) Searching a bitonic array is known as bitonic search. An array is said to be bitonic if it has an increasing sequence of integers followed immediately by a decreasing sequence of integers.…

關于LRU緩存簡單記錄以及代碼補全。

目錄大概思路時間空間復雜度分析指針操作具體細節代碼雙向鏈表設計私有成員變量設計:構造函數和析構函數設計&#xff1a;get與put具體設計雙向指針的具體細節添加到頭節點函數刪除尾節點函數刪除節點函數刪除節點函數感想今天面試考到LRU&#xff0c;太緊張了&#xff0c;完全…

碼農干貨系列【4】--圖像識別之矩形區域搜索

簡介 定位某個圖片的矩形區域是非常有用的&#xff0c;這個可以通過手動的選擇某個區域來實現定位&#xff0c;圖片相關的軟件都提供了這個功能&#xff1b;也可以像本篇一個通過程序來實現智能定位。前者會有誤差&#xff0c;效率低下&#xff1b;后者選區精度高&#xff0c;效…

算法題復習(回溯)

目錄base code棋盤問題51. N 皇后37. 解數獨組合問題77. 組合未剪枝優化剪枝優化216. 組合總和 III未剪枝優化剪枝優化17. 電話號碼的字母組合39. 組合總和未剪枝優化剪枝優化40. 組合總和 II,挺重要的&#xff0c;涉及到去重了切割問題131. 分割回文串子集問題78. 子集90. 子集…

pfa是什么意思_PFA的完整形式是什么?

pfa是什么意思PFA&#xff1a;預測性故障分析 (PFA: Predictive Failure Analysis) PFA is an abbreviation of Predictive Failure Analysis. It is a technique of a mechanism of the computer that is used to predict impending failures of software or hardware compone…

SqlServer視圖(view)

--上節回顧--1.什么是事務--2.事務的特征--原子性、一致性、隔離性、持久性--3.與事務相關的t-sql命令--開啟事務&#xff1a;begin transaction--提交事務&#xff1a;commit transaction--回滾事務&#xff1a;rollback transaction ----------------視圖-------------------…

Android中的廣播Broadcast詳解

今天來看一下Android中的廣播機制&#xff0c;我們知道廣播Broadcast是Android中的四大組件之一&#xff0c;可見他的重要性了&#xff0c;當然它的用途也很大的&#xff0c;比如一些系統的廣播&#xff1a;電量低、開機、鎖屏等一些操作都會發送一個廣播&#xff0c;具體的And…

sql check約束_在SQL中使用CHECK約束

sql check約束Basically, CHECK constraint is used to LIMIT in columns for the range of values. We can use this constraint for single or multiple columns. 基本上&#xff0c; CHECK約束用于限制值范圍內的列 。 我們可以將此約束用于單列或多列。 In single column,…

.NET線程池

摘要 深度探索 Microsoft .NET提供的線程池&#xff0c; 揭示什么情況下你需要用線程池以及 .NET框架下的線程池是如何實現的&#xff0c;并告訴你如何去使用線程池。 內容 介紹 .NET中的線程池 線程池中執行的函數 使用定時器 同步對象的執行 異步I/O操作 監視線程池 死鎖 有關…

折線分割平面

Input輸入數據的第一行是一個整數C,表示測試實例的個數&#xff0c;然后是C 行數據&#xff0c;每行包含一個整數n(0<n<10000),表示折線的數量。Output對于每個測試實例&#xff0c;請輸出平面的最大分割數&#xff0c;每個實例的輸出占一行。Sample Input2 1 2Sample Ou…

《c++特性》

目錄多態構造函數和析構函數存在多態嗎&#xff1f;虛函數表虛析構函數純虛函數和抽象類運行時多態和編譯時多態的區別繼承設計實例指針對象和普通對象的區別正確初始化派生類方式繼承和賦值的兼容規則protected 和 private 繼承基類與派生類的指針強制轉換如何用C實現C的三大特…

Scala中的while循環

在Scala中的while循環 (while loop in Scala) while loop in Scala is used to run a block of code multiple numbers of time. The number of executions is defined by an entry condition. If this condition is TRUE the code will run otherwise it will not run. Scala中…