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

examples: easier to start with data.frame than matrix? #52

Open
Pakillo opened this issue Apr 16, 2024 · 0 comments
Open

examples: easier to start with data.frame than matrix? #52

Pakillo opened this issue Apr 16, 2024 · 0 comments

Comments

@Pakillo
Copy link
Collaborator

Pakillo commented Apr 16, 2024

Function examples (both for daily and monthly data) start with matrices, then convert to data.frame or tibble. I think most people are much more familiar with data.frames or tibbles than matrices nowadays. So I'd revise examples, i.e. starting examples with:

coords <- data.frame(lon = -5.36, lat = 37.40)

rather than starting with

coords <- matrix(c(-5.36, 37.40), ncol = 2)

and then converting to data.frame, which requires naming columns afterwards.

coords <- as.data.frame(coords)
names(coords) <- c("lon", "lat")  # must have these columns

We already made a similar change in the README a while ago

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

1 participant