Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

R Data Set:


R Language: R is a programming language and environment primarily used for statistical computing and graphics. It's popular among statisticians and data miners for data analysis and visualization.

Data Set: In R, a data set is a collection of data organized in a structured format, usually in the form of a table where rows represent individual observations or samples, and columns represent variables or attributes of those observations.

Example: Let's create a simple data set in R. Suppose we want to create a data set of students' exam scores in three subjects: Math, Science, and English.

Example

# Create a data frame (a type of data structure in R) for students' exam scores
student_scores <- data.frame(
Student_ID = c(1, 2, 3, 4, 5), # Student ID numbers
Math = c(85, 72, 90, 78, 88), # Math scores
Science = c(80, 75, 85, 79, 82), # Science scores
English = c(75, 68, 80, 72, 78) # English scores
)

# Print the data set
print(student_scores)

In this example:

The data.frame() function is used to create a data frame in R. We provide the column names and their corresponding values within the function.

After running this code, you'll see a table printed to the console showing the student IDs along with their scores in Math, Science, and English. This table represents our data set in R.


Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java