Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can names still contain hyphen? (Lesson 8) #25

Open
thjbdvlt opened this issue Feb 26, 2025 · 1 comment
Open

Can names still contain hyphen? (Lesson 8) #25

thjbdvlt opened this issue Feb 26, 2025 · 1 comment

Comments

@thjbdvlt
Copy link

I am reading this as someone who is learning R since a few days, and i just read in the README.md here (lesson 8) that

Names must begin with a letter, and consist only of letters, digits and a few special characters such as '-' or '.'

Do names can contains hyphens in special situations that I am not aware of? Or maybe recent R versions (I am using 4.4) changed something about that (as the underscore was added)? In my R version, something like a-b <- 3 produces an error (undefined symbol: a).

@matloff
Copy link
Owner

matloff commented Feb 27, 2025

To be honest, I don't know the answer (which could easily be looked up). My fasteR tutorial AVOIDS that kind of thing, i.e. it consciously avoids starting out with "R variables can be of mode numeric, integer, character and logical. Variable names must start with a letter..." That slows down the learning process, for no good reason IMO.

I like to use names of the form abcDeF, e.g. originalColor and newColor, starting with a lower-case letter and using capitals as punctuation. I hate using _ in names, as it requires that I hunt on the keyboard for that character. :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants