NEP -R PROGRAMMING

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10

PART B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 PROGRAM B7 PROGRAM B8 . . .

 
    
 # Sample data
set.seed(42)  # For reproducibility
data <- rnorm(100)

# Create a new graphics device (optional, useful for saving plots)
# pdf("visual_representations.pdf", width = 8, height = 8)

# Create and display a scatter plot
plot(data, main = "Scatter Plot", xlab = "X-axis", ylab = "Y-axis", col = "blue")

# Create and display a histogram
hist(data, main = "Histogram", xlab = "Value", col = "lightblue", breaks = 20)

# Create and display a line chart
x <- 1:100
y <- cumsum(rnorm(100))
plot(x, y, type = "l", main = "Line Chart", xlab = "X-axis", ylab = "Y-axis", col = "green")

# Create and display a pie chart
slices <- c(10, 15, 25, 50)
lbls <- c("A", "B", "C", "D")
pie(slices, labels = lbls, main = "Pie Chart", col = rainbow(length(slices)))

# Create and display a box plot
boxplot(data, main = "Box Plot", xlab = "Value", col = "purple")

# Create and display a scatter plot
x <- rnorm(50)
y <- x + rnorm(50, sd = 0.2)
plot(x, y, main = "Scatter Plot", xlab = "X-axis", ylab = "Y-axis", col = "red")

# Close the graphics device (if opened)
# dev.off()