-2

Hi I'm trying to import a YAML file (*.yamloo) into R Studio for analysis.

I'm using the YAML package for RStudio. Here's what I tried:

library(yaml)
data -> yaml.load_file("vn.yamloo")

I get this error message:

Error in yaml.load_file("vn.yamloo") <- data : 
target of assignment expands to non-language object

Is a .yaml file the same as a .yamloo file; and is it overall possible to do this for RStudio?

Edit: That was really a retarded question sorry for wasting your time.

1
  • 2
    Use <- instead of ->.
    – shadow
    Apr 17, 2015 at 14:34

2 Answers 2

5

Use proper operator for assigning data to variables = or <-

install.packages("yaml") # Be sure you have yaml package installed 
library(yaml) 
data <- yaml.load_file("path_to_file/file.yaml")

To be extra sure that your file will be load properly, try to use absolue paths or before including files set working directory setwd("/path/to/the/directory")

1

These errors occur when you try to assign a value to a variable that doesn't exist, or that R can't treat as a name.

data -> yaml.load_file("vn.yamloo")

You are assigning data to yaml.load_file("vn.yamloo"). so you needed to do the other way:

data <-  yaml.load_file("vn.yamloo")

Not the answer you're looking for? Browse other questions tagged or ask your own question.