Testing values in R

  • Comments posted to this topic are about the item Testing values in R

  • Good question, thanks, learned something new in R.

    ...

  • Yes good question. Something new. Thanks Steve.

  • Finally an R question I knew without research. Still amazed at the power of the R language to automate some data cleansing jobs we've been working through.

  • Nice one, thanks Steve

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    β€œlibera tute vulgaris ex”

  • Elementary, dear Watson. πŸ˜‰

    Thanks, Steve!

  • Thanks for another lesson in R-language. I was a bit confused by the title of today's QotD "Testing values in R", but I tried again something new.
    The usage of the function in the form REP() I do not recommend...πŸ˜‰

  • George Vobr - Wednesday, May 10, 2017 9:42 AM

    Thanks for another lesson in R-language. I was a bit confused by the title of today's QotD "Testing values in R", but I tried again something new.
    The usage of the function in the form REP() I do not recommend...πŸ˜‰

    I agree that "REP" is an odd form.
    The  answer is  a bit  off, as rep can do a lot more than just replicate a string.  It can replicate non-string  arguments (vectors, dates, times, and more) and the "each" argument allows it to do two-dimensional replication of vectors (or component-wise one-dimensional representation if the tiimes argument is 1 and the length.out argument is NA) and I haven't yet grasped exactly what the length.out argument does when it isn't NA (haven't really tried yet).  But I guess we are all beginners in R and the tutorial that Steve pointed us to in a previous qotd introduces rep with the string replication mode, and teh answer is fair for beginners.

    Tom

  • Just to point out that R is a case-sensitive language, so REP actually is not a defined function. 
    Assuming that the function was rep(x, ...), well, the correct answer would be "Replicate Elements of Vectors and Lists", replicate a single string is just a very limited example of what this powerful function does. 
    Let's try in R something like this:  rep(1:4, 4:1) πŸ˜‰ or a more diabolic rep(1:9, c(0,0,0,0,0,3,0,0,0)) :blush:
  • Sorry, keyword habit of capitalizing those.

    Corrected.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply