Reading a CSV into DataFrame issues

I am very new to Julia and I know there are lots of growing pains associated with moving to v1.0, not sure if this is related. I am trying to read in a simple 3 columns csv file and am getting the following error. I just installed DataFrames and CSV and got no errors. Can anyone point me in the right direction?

methoderror no method matching -(::DataFrame)

The script is below:

using Pkg
using DataFrames
using CSV

sample_df <-"data/test.csv")

1 Like

Julia uses = as assignment operator instead of <- so you can write:

sample_df ="data/test.csv")

When you write:

sample_df <-"data/test.csv")

Julia reads it as if you wanted to use < to compare sample_df and"data/test.csv") and as"data/test.csv") returns a DataFrame it complains that it does not know how to negate it.


Wow thank you so much. I am so embarrassed to have missed that, clearly I have been in R land WAY to long. At least this will help me remember to use = instead of <- going forward.

Thank you again for pointing it out, I guess it takes things like this and pushing through silly little things to get comfortable with a new language after many many years of another one.

My mind never quite got used to the <- operation in R. How come someone would want to use that as assignment?

As far as I know R is the only language that uses <- as assignment. The use of = as assignment is extremely common and goes all the way back to some of the earliest programming languages. The disadvantage of this is that the actual equality comparison operator is relegated to ==, again a very common and old practice.

I personally like the := assignment operator of Mathematica and the occasional math paper, but admittedly, as assignment is one of the most common operations in programming, it’s useful to be able to express it as a single character.

Agreed, I think = makes total sense. Even in R you still end up using == a lot of equality so it doesnt really help you to use ->

I came into programming through R which is a strange way to come at it (although it got me into c++ as well which has been a great learning experience). SO much about Julia excites me after having played around with various languages from c++ to F#/ocaml to python. I really like some of the design choices that were made in the language and am eager to shake off some bad R habits (that I know are bad but are muscle memory after years of tons of code).

Hopefully my next question is a better one. Thank you all for making my first community interaction a positive one!