Invalid (NULL) left side of Assignment in R

I was trying to compile a function in R and came across this error

loadchar() <- function( path, filename){ …

}

Error in loadchar() <- function(path, filename) { :
invalid (NULL) left side of assignment

I couldn’t find much on the internet but the answer (in my case at least)  was simple…

The issue is the brackets in the function name ie it should be

loadchar <- function( path, filename){ …

}

an easy mistake to make … especially if you are jumping between languages regularly