r中将数据框中数据类型转化_R中的数据类型

r中将数据框中数据类型转化

Data types are kept easy.

数据类型保持简单。

Data types of R are quite different when we compare with other programming languages. Here, we’ll outline the data types of R.

当我们与其他编程语言进行比较时,R的数据类型完全不同。 在这里,我们将概述R的数据类型。

整数 (Integers)

Integers are numbers without a decimal point. Unlike other programming languages, R represents all integers as a “double” data type. But the main difference is, you need to write “L” to represent integers in arithmetic operations. For example 9L.

整数是没有小数点的数字 。 与其他编程语言不同,R将所有整数表示为“双精度”数据类型。 但是主要的区别是,您需要写“ L”来表示算术运算中的整数。 例如9L。

(Double)

Instead of floats, R has a double data type to represent both for making arithmetic calculations simpler. And when you look for integers and floats in programming languages, you’ll see double after writing the function to specify the data type. As an example: 9 and 3,4.

代替浮点数,R具有双精度数据类型来表示两者,以简化算术运算 。 而且,当您使用编程语言查找整数和浮点数时,在编写用于指定数据类型的函数后,您会看到double。 例如:9和3,4。

向量 (Vectors)

The most basic data type of R that is the lifeblood of its operations because R works with vectorized operations. When we define vectors in R, they’re a sequence of the data element of the same basic time. It only contains the element of the same data type. If not, R will try to convert it into the most dominant data type.

R的最基本数据类型是其操作的生命线,因为R与矢量化操作一起使用 。 当我们在R中定义向量时,它们是同一基本时间的数据元素序列。 它仅包含相同数据类型的元素。 如果不是,R将尝试将其转换为最主要的数据类型。

复杂 (Complex)

The complex data type is only used to represent complex (imaginary) numbers in R. Unlike most data types, the complex data type is not used commonly in R. We can give a+bi as an example.

复数数据类型仅用于表示R中的复数(虚数) 。 与大多数数据类型不同,复杂数据类型在R中并不常用。我们可以举a + bi为例。

逻辑上 (Logical)

It works with the same logic with boolean data type in other programming languages. It’s used to give output about whether the statement is true or false with vectorized operations. When compared to the use of other data types in R, it’s useful when doing operations to validate the data.

它与其他编程语言中的布尔数据类型具有相同的逻辑。 它用于通过向量化操作输出有关该语句是对还是错的输出 。 与R中其他数据类型的使用相比,在执行操作以验证数据时很有用。

矩阵 (Matrices)

Same with vectors, matrices only take a data type with column names and row names. They’re used to transform vectorized data into a matrix to make the data clean and made ready for analysis.

与向量相同,矩阵仅采用具有列名和行名的数据类型。 它们用于将矢量化数据转换为矩阵,以使数据整洁并准备进行分析。

功能 (Functions)

Like in other programming languages, R has various built-in functions to do operations. But, R has many specialized functions in its text editor without the need for importing certain libraries. It works the same logic with other programming languages; you have an input and it gives you an output when the conditions are met.

与其他编程语言一样,R具有各种内置函数来执行操作。 但是,R在其文本编辑器中具有许多专门功能,而无需导入某些库。 它与其他编程语言具有相同的逻辑。 您有一个输入,当满足条件时它会为您提供输出。

What do you think about data types in R? Share your thoughts in the comments section below.

您如何看待R中的数据类型? 在下面的评论部分中分享您的想法。

翻译自: https://medium.com/dev-genius/data-types-in-r-85aebe70416a

r中将数据框中数据类型转化

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值