object not found error

Hi,

Welcome to the RStudio community!
When I try the declaration of a variable like you showed, both options are working for me:

var1 <- "hello"
var1
[1] "hello"

var2 <-"hello"
var2
[1] "hello"

Could you try and create a Reprex so we get a better idea what's going on? A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

PJ