Suraj Kumar
Suraj Kumar

Reputation: 35

I am trying to plot the data of a data frame in R

I used the following code:

data2=data.frame(x=runif(100,2,3),y=runif(100,2,3))

head(data2)

 plot(data$x,data$y,main="data2",xlab="AE",ylab = "vibration")
 Error in plot.window(...) : need finite 'xlim' values
 In addition: Warning messages:
 1: In min(x) : no non-missing arguments to min; returning Inf
 2: In max(x) : no non-missing arguments to max; returning -Inf
 3: In min(x) : no non-missing arguments to min; returning Inf
 4: In max(x) : no non-missing arguments to max; returning -Inf

Can anyone tell me what is wrong I am doing with above syntax.

Upvotes: 0

Views: 35

Answers (1)

Suraj Kumar
Suraj Kumar

Reputation: 35

One must be very carefull about the silly mistakes, The data set you are trying to generate for data has a different varaible name. data2 should be used in place of data

The code will be as follows

plot(data2$x,data2$y,main="data2",xlab="AE",ylab = "vibration")

This ensure the plot with well defined labels you expect.

Upvotes: 1

Related Questions