feat(r): hello world
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
8be85a3a4f
commit
f4bf341e34
6 changed files with 111 additions and 0 deletions
25
r/hello-world/.exercism/config.json
Normal file
25
r/hello-world/.exercism/config.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"authors": [
|
||||
"jonboiser"
|
||||
],
|
||||
"contributors": [
|
||||
"jonmcalder",
|
||||
"katrinleinweber",
|
||||
"ttnagata",
|
||||
"zacchaeusluke"
|
||||
],
|
||||
"files": {
|
||||
"solution": [
|
||||
"hello-world.R"
|
||||
],
|
||||
"test": [
|
||||
"test_hello-world.R"
|
||||
],
|
||||
"example": [
|
||||
".meta/example.R"
|
||||
]
|
||||
},
|
||||
"blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
|
||||
"source": "This is an exercise to introduce users to using Exercism",
|
||||
"source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
|
||||
}
|
1
r/hello-world/.exercism/metadata.json
Normal file
1
r/hello-world/.exercism/metadata.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"track":"r","exercise":"hello-world","id":"070beed7e22445ff9d08d9d1b48ff931","url":"https://exercism.org/tracks/r/exercises/hello-world","handle":"cafkafk","is_requester":true,"auto_approve":false}
|
38
r/hello-world/HELP.md
Normal file
38
r/hello-world/HELP.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Help
|
||||
|
||||
## Running the tests
|
||||
|
||||
Tests require the `{testthat}` package to be installed in R.
|
||||
To run the tests for an exercise, simply execute the `test_<exercise_name>.R` script from within the exercise's directory.
|
||||
|
||||
This can be conveniently done with [testthat's `auto_test` function](https://testthat.r-lib.org/reference/auto_test.html). Because exercism code and tests are in the same folder, use this same path for both `code_path` and `test_path` parameters. On the command-line, you can also run `Rscript test_<exercise_name>.R`.
|
||||
|
||||
See the [tests page](https://exercism.org/docs/tracks/r/tests) for more information.
|
||||
|
||||
## Submitting your solution
|
||||
|
||||
You can submit your solution using the `exercism submit hello-world.R` command.
|
||||
This command will upload your solution to the Exercism website and print the solution page's URL.
|
||||
|
||||
It's possible to submit an incomplete solution which allows you to:
|
||||
|
||||
- See how others have completed the exercise
|
||||
- Request help from a mentor
|
||||
|
||||
## Need to get help?
|
||||
|
||||
If you'd like help solving the exercise, check the following pages:
|
||||
|
||||
- The [R track's documentation](https://exercism.org/docs/tracks/r)
|
||||
- The [R track's programming category on the forum](https://forum.exercism.org/c/programming/r)
|
||||
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
|
||||
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)
|
||||
|
||||
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.
|
||||
|
||||
To get help if you're having trouble, you can try one of the following resources:
|
||||
|
||||
- [StackOverflow](https://stackoverflow.com/questions/tagged/r) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions.
|
||||
- [#rstats](https://twitter.com/search?q=%23rstats) is the hashtag to use if you are asking for help or guidance on Twitter. The R community is very active on Twitter and always try to help those who are new to R.
|
||||
- [/r/rstats](https://www.reddit.com/r/rstats) is the R subreddit.
|
||||
- [RStudio Community](https://community.rstudio.com/) is another active and helpful R community.
|
38
r/hello-world/README.md
Normal file
38
r/hello-world/README.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Hello World
|
||||
|
||||
Welcome to Hello World on Exercism's R Track.
|
||||
If you need help running the tests or submitting your code, check out `HELP.md`.
|
||||
|
||||
## Instructions
|
||||
|
||||
The classical introductory exercise.
|
||||
Just say "Hello, World!".
|
||||
|
||||
["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.
|
||||
|
||||
The objectives are simple:
|
||||
|
||||
- Modify the provided code so that it produces the string "Hello, World!".
|
||||
- Run the test suite and make sure that it succeeds.
|
||||
- Submit your solution and check it at the website.
|
||||
|
||||
If everything goes well, you will be ready to fetch your first real exercise.
|
||||
|
||||
[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
|
||||
|
||||
## Source
|
||||
|
||||
### Created by
|
||||
|
||||
- @jonboiser
|
||||
|
||||
### Contributed to by
|
||||
|
||||
- @jonmcalder
|
||||
- @katrinleinweber
|
||||
- @ttnagata
|
||||
- @zacchaeusluke
|
||||
|
||||
### Based on
|
||||
|
||||
This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
|
3
r/hello-world/hello-world.R
Normal file
3
r/hello-world/hello-world.R
Normal file
|
@ -0,0 +1,3 @@
|
|||
hello_world <- function() {
|
||||
"Hello, World!"
|
||||
}
|
6
r/hello-world/test_hello-world.R
Normal file
6
r/hello-world/test_hello-world.R
Normal file
|
@ -0,0 +1,6 @@
|
|||
source("./hello-world.R")
|
||||
library(testthat)
|
||||
|
||||
test_that("no name", {
|
||||
expect_equal(hello_world(), "Hello, World!")
|
||||
})
|
Loading…
Add table
Reference in a new issue