This is the the homework: (redacted)
I'm stuck at the beginning, since i do not understand how to make R read numbers like 0,1,2,3... as 00,01,02...
It doesn't affect my evaluation, but i would really appreciate to make a good first impression on my teacher.
Thanks in advance for anyone helping.
Hi, welcome!
Please have a look to our homework policy, homework inspired questions are welcome but they should not include verbatim instructions from your course.
Can I ask questions from a course I am taking here?
General questions are always welcome!
Please do ask general questions about things like:
How to use R
How to use the RStudio IDE or RStudio Cloud
How to work with tidyverse packages
Where to find resources to help you learn or solve problems
Specific questions can be OK, if you follow these rules:
Never copy-paste instructions from an assignment (even for online courses).
Explicitly mention the course you are taking and use the #homework tag.
Ask your question as a reproducible example (reprex) , preferably prepared for posting using the reprex package .
Want to maximize your chances of getting the help you need? Keep readin…
2 Likes
I hope I am not breaking our homework policy; look at the difference between numeric and character variables.
fcas80
November 8, 2022, 8:42pm
4
x <- seq(from=0, to=9, by=1)
x <- as.character(x)
x
y <- paste("0", x, sep = "")
y
This converts numbers 0 through 9 to characters, and then pastes a leading zero.
Note that if you have numbers 10 and higher, you may want to convert them to characters to be consistent with 0 through 9.
1 Like
system
Closed
December 20, 2022, 8:42pm
5
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.