Object not found

0

I made the following commands in the R:

setwd:(###)
data1<-read.table("scatter1.txt",header=T)
head(data1)
tail(data1)
summary(data1)
str(data1)
names(data1)
plot(xv,ys,col="red")

And the message below appeared:

  

Error in eval (predvars, data, env): object 'xv' not found

What could be wrong?

    
asked by anonymous 23.03.2018 / 15:23

1 answer

0

As William asked ... Probably your data does not have a column named 'xv'.

Imagine the example:

# criando dados
xv <- runif(9)
yv <- runif(9)


# cria o dataframe
data1 <- data.frame(xv,yv)

data1

xv         yv
1 0.790820953 0.87757976
2 0.909833827 0.42454033
3 0.238349353 0.81647967
4 0.723215071 0.26172111
5 0.003577045 0.58418732
6 0.763899972 0.02090613
7 0.285341114 0.39609819
8 0.340382556 0.27279806
9 0.903062143 0.20278835

To plot the data, you should put the dataframe and data column reference:

plot(data1$xv,data1$yv)

    
04.04.2018 / 21:57