muhammad daniyal
muhammad daniyal

Reputation: 11

exporting data from excel to R

 library(readxl)
DATA <- read_excel("C:/Users/M.Daniyal/Desktop/coronoa/DATA.xlsx", 
     col_types = c("numeric", "numeric"), 
     na = "NA")
 View(DATA)
 plot(x,y)

Error in plot(x, y) : object 'x' not found

its giving error that x is not found. how can I resolve this problem

Upvotes: 0

Views: 35

Answers (1)

akrun
akrun

Reputation: 887951

The object created is 'DATA'. The columns in that object is only accessible inside the environment of 'DATA' unless we attach (not recommended) to create the column names also as objects in the global environment.

With the current code, can use either extractors ([[ or $)

plot(DATA$x, DATA$y)

Or a formula object

plot(y ~ x, DATA)

or with

with(DATA, plot(x, y))

Upvotes: 1

Related Questions