0% found this document useful (0 votes)
2 views

r programming

The document provides a comprehensive overview of R programming concepts, including definitions of key terms such as CRAN, data visualization, data types, and statistical testing. It explains various functions and structures in R, such as dataframes, vectors, and plots, as well as statistical methods like ANOVA and linear regression. Additionally, it covers practical applications and examples related to data analysis and visualization.

Uploaded by

fasilkm111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

r programming

The document provides a comprehensive overview of R programming concepts, including definitions of key terms such as CRAN, data visualization, data types, and statistical testing. It explains various functions and structures in R, such as dataframes, vectors, and plots, as well as statistical methods like ANOVA and linear regression. Additionally, it covers practical applications and examples related to data analysis and visualization.

Uploaded by

fasilkm111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

Define CRAN

→CRAN (Comprehensive R Archive Network) is an online repository


for R packages, software, and documentation. It helps users access
and manage resources for statistical computing and data analysis.

2. What is R Programming?

→R is an open-source programming language and environment used


for statistical analysis, data visualization, and machine learning. It
supports various functions, packages, and tools for data
manipulation and representation.

3. What is Data Visualization?

→Data visualization is the representation of data in graphical


formats like charts, graphs, and plots. It helps to identify patterns,
trends, and insights effectively.

4. What are the Datatypes available in R?

→Datatypes in R include numeric, integer, character, logical,


complex, and raw. These types handle numbers, text, TRUE/FALSE
values, and more.

5. Define Factor

→A factor in R represents categorical data as levels, making it


efficient for analysis. It is used for data like gender, regions, or age
groups.

6. What is Dataframe?

→A dataframe in R is a table-like structure with rows and columns,


where each column can store different datatypes. It is used for
organizing datasets.

7. Define paste()

→The paste() function in R concatenates strings with a specified


separator. For example, paste("R", "Programming", sep = " ")
outputs "R Programming".

8. What is the difference between Array and Matrix?


→An array can have multiple dimensions (e.g., 2D, 3D), while a
matrix is strictly two-dimensional. Both require elements to be of
the same datatype.

9. Explain Vector

→A vector in R is a sequence of elements of the same datatype, such


as numeric, character, or logical. It is created using the c() function.

10. What is Coercion?

→Coercion is the automatic or manual conversion of data from one


type to another, like numeric to character, ensuring compatibility in
operations.

11. What is Plot?

→A plot is a graphical representation of data in R. It is created using


functions like plot() to display trends or relationships visually.

12.Write the syntax of else if in R

→If (condition1) {

# Code if condition1 is TRUE

} else if (condition2) {

# Code if condition2 is TRUE

} else {

# Code if none of the conditions are TRUE

13.What is Nested If Statement?

→A nested if statement is an if statement placed inside another if


statement. It allows testing multiple conditions sequentially.

14.State the difference between Repeat and Break

→The repeat loop in R runs indefinitely until explicitly stopped. The


break statement is used to exit from loops, including repeat, while,
or for.

15.What is Standalone Statement?


→A standalone statement is an independent executable line of code
in R, such as function calls or variable assignments.

16.State the Use of warning() Function

→The warning() function in R generates a warning message but does


not stop program execution. It alerts users about potential issues.

17.What is File? Why Do You Need File in Programming?

→A file is a container to store data persistently. Files are needed in


programming to save data for future use or share data between
systems.

18.What Do You Mean by .csv Files?

→A .csv file (Comma-Separated Values) is a plain text file used to


store tabular data. It separates values using commas, making it
easy to import/export in applications.

19.What is Timing?

→Timing in R refers to measuring the execution time of code using


functions like Sys.time() or system.time(). It helps in optimizing
performance.

20.Define Visibility

→Visibility in R refers to whether an object, function, or variable is


accessible in a given scope or environment of the program.

21.What is Namespace?

→A namespace in R is a mechanism to manage variable and function


names within a package, avoiding conflicts with other packages.

22.Define Box Plot

→A box plot is a graphical representation of data distribution,


showing the median, quartiles, and outliers. It helps in identifying
the spread and skewness of data.

23.What are the Uses of Histograms?


→Histograms are used to visualize the frequency distribution of
numerical data. They help in identifying patterns like skewness,
modality, and data range.

24.What is Statistics?

→Statistics is a branch of mathematics that deals with collecting,


analyzing, interpreting, and presenting data to make informed
decisions.

25.Define Probability

→Probability is the measure of the likelihood that a particular event


will occur, expressed as a value between 0 and 1.

27.What is Random Variable?

→A random variable is a variable whose possible values are


determined by a random experiment, representing outcomes
numerically.

28.State the R Function Used to Find Mean

The mean() function is used in R to calculate the arithmetic mean of


a set of numbers.

29.Explain Cumulative Sum

→A cumulative sum is the running total of a sequence of numbers,


calculated by successively adding each value to the sum of the
previous values. In R, it is computed using cumsum().

30.What is the Difference Between Integral and Calculus?

→An integral is a part of calculus and represents the area under a


curve. Calculus is a broader field, including differentiation and
integration, for studying change and accumulation.

31.Find the Mean and Mode of the Data

→Data: 2, 3, 5, 6, 10, 6, 12, 6, 3, 4

Mean = (2 + 3 + 5 + 6 + 10 + 6 + 12 + 6 + 3 + 4) / 10 = 57 / 10 = 5.7

Mode = The most frequent value = 6


32.State Any Two Applications of Bernoulli Distribution

•Modeling binary outcomes such as success/failure or yes/no.

•Used in machine learning algorithms for classification tasks.

33.What is qbern() Function?

→The qbern() function in R computes the quantile function for the


Bernoulli distribution, giving the smallest value such that the
cumulative probability is at least a given value.

34. What is Statistical Testing?

→Statistical testing involves analyzing data to make decisions or


inferences about populations based on sample data, using methods
like t-tests, ANOVA, or chi-square tests.

35.Expand ANOVA

→ANOVA stands for Analysis of Variance.

36. What is Hypothesis?

→A hypothesis is a statement or assumption about a population


parameter that can be tested using statistical methods.

37. Define Power

→Power is the probability of correctly rejecting a false null


hypothesis in a statistical test, indicating the test's effectiveness.

38. Differentiate One-Tailed and Two-Tailed Hypothesis

→•One-Tailed Hypothesis: Tests for an effect in a specific direction


(e.g., greater than or less than).

•Two-Tailed Hypothesis: Tests for an effect in either direction (e.g.,


different from a value).

39.State Any One Assumption of ANOVA

→The variances of the groups being compared should be


approximately equal (homogeneity of variance).

40.Expand MANOVA

→MANOVA stands for Multivariate Analysis of Variance.


41. Write Any Two Statistics Formulas

→•Mean:

•Variance:

42.What is Linear Regression?

→Linear regression is a statistical method used to model the


relationship between a dependent variable and one independent
variable using a straight line.

43.What is Negative Linear Relationship?

→A negative linear relationship occurs when one variable decreases


as the other increases, resulting in a downward-sloping line on a
scatter plot.

44.Give One Example for Multiple Linear Regression

→Predicting house prices based on features like size, number of


bedrooms, and location.

45.State the Different Ways to Declare Colors

→Colors can be declared using names (e.g., “red”), hex codes (e.g.,
“#FF0000”), or RGB values (e.g., rgb(255,0,0)).

46.Define Plotly

→Plotly is an open-source graphing library used for creating


interactive and dynamic visualizations like scatter plots, bar charts,
and heatmaps.

47.Define Multiple Linear Regression

→Multiple linear regression models the relationship between a


dependent variable and two or more independent variables,
expressed as a linear equation.

You might also like