BMR AI
By using this service you agree to read and accept our Terms and conditions and Privacy Policy
Chat Now
GUIDE

Welcome to our BMR AI CHATBOT.

A free expermental AI tool where you can interact with the webpage, ask question about the webpage and other related doubts.

In some cases reponses may take time to get. In case of error give us your report.

You responses are stored for experimental purpuses. And your personal info is not integrated with you in any way.

Note: AI can make mistakes and can give in appropiate responses. Your feedbak will help us improve.

Stay tuned for more AI products and tools

And Finally don't forget to give your feedback. click on the icon provided to give feedback.

REPORT ERROR

SUBMIT
DELETE CHAT

R Number Data Types

In Previous topics we leared about different data types
Here we are going to about different types of data types which holds numbers
There are three types

Data Type

Description

Example

Numeric

Real or decimal numbers

num_var <- 3.14

Integer

Whole numbers

int_var <- 42L

Complex

Complex numbers

complex_var <- 2 + 3i


Example

# Numeric
num_var <- 3.14

# Integer
int_var <- 42L

# Complex
complex_var <- 2 + 3i

# Print variables
print(num_var)
print(int_var)
print(missing_var)

Type Conversion

It is a buit-in function method to convert a data type to another data type.

  1. as.integer() - Converts a numeric to an integer.
  2. as.numeric() - Converts an integer to a numeric.
  3. as.complex() - Converts numeric and integer to complex.

Example

# Numeric to Integer
num_var <- 42.75
int_var <- as.integer(num_var)

# Integer to Numeric
another_int_var <- 30L
numeric_from_int <- as.numeric(another_int_var)

# Numeric to Complex
complex_from_numeric <- as.complex(num_var)

# Integer to Complex
complex_from_int <- as.complex(another_int_var)

# Complex to Numeric
numeric_from_complex <- Re(complex_from_numeric)  # Taking the real part

# Print Results
print("Numeric to Integer:")
print(num_var)
print(int_var)

print("Integer to Numeric:")
print(another_int_var)
print(numeric_from_int)

print("Numeric to Complex:")
print(complex_from_numeric)

print("Integer to Complex:")
print(complex_from_int)

print("Complex to Numeric:")
print(numeric_from_complex)

Quick Recap - Topics Covered

R Lists

Practice With Examples in Compilers

The Concepts and codes you leart practice in Compilers till you are confident of doing on your own. A Various methods of examples, concepts, codes availble in our websites. Don't know where to start Down some code examples are given for this page topic use the code and compiler.

Example JS

Example 1 Example 2 Example 3 Example 4 Example 5

Quiz


FOLLOW FOR MORE UPDATES

Official Facebook Account Official Instagram Account Offcial X (formerly known as Twitter) Account Offficial Youtube Channel
BMR EDUCATION © 2024 All rights reserved