0% found this document useful (0 votes)
3 views3 pages

Program 2 (DA)

The document introduces vectors in R programming, highlighting their importance as a fundamental data structure for storing multiple values of the same type. It outlines various operations that can be performed on vectors, such as arithmetic and logical operations, and provides a series of programming questions aimed at practicing these concepts. Each question includes a prompt for code and expected output, focusing on practical applications of vector manipulation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Program 2 (DA)

The document introduces vectors in R programming, highlighting their importance as a fundamental data structure for storing multiple values of the same type. It outlines various operations that can be performed on vectors, such as arithmetic and logical operations, and provides a series of programming questions aimed at practicing these concepts. Each question includes a prompt for code and expected output, focusing on practical applications of vector manipulation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program 2

INTRODUCTION TO VECTORS IN R.

In R programming, a vector is the most basic and important data structure used to
store multiple values in a single variable. All elements in a vector must be of the
same data type, such as numeric, character, or logical. Vectors are used to perform
various mathematical, statistical, and logical operations efficiently. They can be
created using the c() function and support operations like addition, subtraction,
sorting, filtering, and finding maximum or minimum values. Vectors play a
fundamental role in data manipulation and analysis in R, making them essential for
statistical computing and programming

[Link] a progam to check wether a given number is +ve even number


or -ve even number?
Ans Code: Output:

[Link] a program to take name and age as an input and check wether
he/she is eligible for vote or not?
Ans Code: Output:

Q3 Write a program to perform various arithmetic and logical operator


on vector?

Ans Code: Output:


Q4 Write a program to take input a year and check whether it is leap
year or not?
Ans Code: Output:

Q5 Write a program to perform numerical operations such as max ,min


average,square root,round off ,sum on a vector of 7?
Ans Code: Output:

Q6 Write a program to arrange all the values in ascending or descending


order?
Ans Code: Output:

Q7Write a program to count a value in a range from a particular vector ?


Ans Code: Output:
Q8 Write a Program to find a common element among three different
vector?
Ans Code: Output:

Q9 Write a program to find all distinct elements from a given vector?


Ans Code: Output:

Q10 Write a program to test if a particular value is a part of vector or not?


Ans Code: Output:

You might also like