R is a powerful programming language and environment for statistical computing, data analysis, and visualization. It is widely used by data scientists, statisticians, and analysts to clean data, explore patterns, create plots, and build models. R comes with a rich ecosystem of packages, making it versatile for a wide range of analytics tasks.
RStudio is a popular IDE for writing and running R code efficiently.
You can start running R commands immediately in the console or an R script. Here’s a simple example:
# Print a simple message to the console
print("Hello, R!")
This prints "Hello, R!"
in the console and confirms that your R environment is working.
R makes it easy to create visualizations. Here’s a basic example of a scatter plot:
# Create sample data
x <- c(1, 2, 3, 4, 5)
y <- c(2, 4, 6, 8, 10)
# Plot the data
plot(x, y, main="Basic Scatter Plot", xlab="X Values", ylab="Y Values", col="blue", pch=19)
This code generates a simple scatter plot with labeled axes, a title, and colored points. Visualizations like this help you explore and understand your data quickly.