Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I did not know you could load packages. I'd suggest arranging the data by innauguration date just as precaution. I like the use of map_chr(). Check my solution; I used only base-R.
not for very large numbers
A couple of things...
In R it is almost never to return
NULL
. If you want the coder to reutrn "nothing", far better ischaracter(0)
so the return type is consistent for all cases. But, R has something very few other languages have, the ability to represent "unknown" values withNA
. Either of these would be more appropriate for the language thanNULL
. In this, specific, context, I thinkNA
would be most appropriate for any date after April 30, 1789 since there is a US President for all of those dates (presumably into the future as well) even if we don't know who it is, andcharacter(0)
for any dates before that since there was no US President before that date.As far as the problem goes,
should be,
Since US Presidents are elected for 4 year terms.
Don't worry about it, and thank you.
Please accept my sincerest apologies, I didn't mean to spoil the kata. Take care.
Hi, please use the spoiler tag when posting code, otherwise everyone can see it.
This comment is hidden because it contains spoiler information about the solution
The
presidents
data frame seems to be broken. As is, I get an error,$ operator is invalid for atomic vectors
, when attempting to access a column ofpresidents
, but if I copy/paste the data frame definition from the instructions to the sample tests area, everything runs fine.Wiki - Creating your first kata
Also, read how othjer people did it. When you solve a kata, you can look at the tests. If you fork a solution, you can look at Preloaded ( where applicable ).
Try to learn from others' mistakes - life's too short. Read comments on existing kata as well.
Figured out how to delete the JS version.
It's in R, not JS. Are you wanting to translate this?
I've been googling to figure out how to do a random test. Do you have a reference?
There's a broken JavaScript version.
No random tests.