1. Explain open source nature of R?
R is open-source software, meaning it is free to use, modify, and distribute. Its source code is
available under the GNU General Public License (GPL). This encourages collaboration, community
contributions, and development of new packages by statisticians and programmers worldwide.
2. What is R programming?
R is a programming language and environment specifically designed for statistical computing, data
analysis, and graphical visualization.
3. Write any two uses of R programming?
1) Statistical analysis (e.g., regression, hypothesis testing). 2) Data visualization (e.g., plots,
graphs, dashboards).
4. Why is R important for statistical computing?
R provides a wide range of statistical techniques, built-in functions, and specialized packages. It
also supports data handling, graphical representation, and reproducibility of research.
5. List any three data types in R programming?
1) Numeric 2) Character 3) Logical
6. How do you install the R studio?
1) Download R (from CRAN: https://cran.r-project.org). 2) Download RStudio (from
https://posit.co/download/rstudio/). 3) Install R first, then install RStudio.
7. What is the difference between R and R studio?
R: The actual programming language and computing engine. RStudio: An Integrated Development
Environment (IDE) that makes using R easier with a user-friendly interface, editor, console, and
tools.
8. Describe the interface of R studio?
RStudio has four main panels: - Source/Script Editor (top-left) - Console (bottom-left) -
Environment/History (top-right) - Files/Plots/Packages/Help (bottom-right)
9. Define Variables in R?
A variable is a named storage that holds data or values. Example: x <- 10
10. Explain the use of R as calculator?
R can directly perform arithmetic operations in the console: 2 + 3 (Addition) 5 * 4 (Multiplication) 10 /
2 (Division)
11. Explain numeric and character Data type?
Numeric: Represents numbers (e.g., x <- 10.5). Character: Represents text/strings (e.g., name <- 'R
Language').
12. Describe how variables are assigned in R?
Variables are assigned using: x <- 5 y = 10 z <<- 15 (Global assignment)
13. What are the steps to install R in Windows?
1) Go to CRAN website. 2) Select 'Download R for Windows.' 3) Choose 'base' → Download latest
version. 4) Run installer and follow setup wizard.
14. Differentiate between x <- 5 and x = 5?
x <- 5: Recommended assignment operator in R. x = 5: Also works but mostly used for function
arguments.
15. Explain how to use R for simple arithmetic operations.
a <- 10, b <- 4 - a + b (Addition) - a - b (Subtraction) - a * b (Multiplication) - a / b (Division) - a ^ b
(Power)
16. What is vector in R?
A vector is a one-dimensional collection of elements of the same data type.
17. Write the syntax to create a vector in R?
v <- c(1, 2, 3, 4, 5)
18. What are the types of Vectors in R?
1) Numeric vectors 2) Character vectors 3) Logical vectors
19. Explain how to access elements of a vector in R?
v <- c(10, 20, 30, 40) v[1] → First element v[2:3] → Second to third element v[-1] → All except first
element
20. List operations you can perform over the vector.
Arithmetic (+, -, *, /) Logical (>, <, ==) Statistical functions (sum(), mean(), length())
21. How do you check the length of a vector in R?
v <- c(5, 10, 15, 20) length(v)
22. Describe vector coercion with an example.
When combining different data types in a vector, R converts them to a common type. v <- c(1, 'R',
TRUE) Result: '1' 'R' 'TRUE' (all converted to character)
23. Explain recycle rule in vector arithmetic.
If vectors of unequal length are operated on, the shorter one is recycled (repeated) to match the
length. x <- c(1,2,3,4) y <- c(10,20) x + y → (11,22,13,24)