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.
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
# 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)
It is a buit-in function method to convert a data type to another data type.
# 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)
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.