Closed brichard1638 closed 11 months ago
Hi Brice, this function is ready! When you have some time, take a look. I am looking to finalize the functions.
The bionic_txt function has been tested in quickcode version .6
The bionic_txt function passed the output format configuration test.
However, the bionic_txt function failed the data object test. When the output from the bionic_txt function is saved as a data object, it cannot be recalled but instead, returns a NULL value.
For error reproducibility, see the following code:
library(quickcode)
x = "This is a test of the emergency broadcast system and non-parametric models."
genbt = bionic_txt(x)
genbt NULL
NOTE: If it turns out that the formatted output from the bionic_txt function cannot be captured in an independent R data object, the following recommendation is provided:
Not sure why you are seeing NULL. Below is my output. I am surprised that it is different from yours. Can you reinstall and try again. Unless if I am getting your message above wrong.
Okay! I had a conflict on my end. Actually, I had the original bionic_txt function independently running in an R session which caused a conflict.
I am confirming, after testing the bionic_txt function in quickcode version 0.6 that it executes as designed.
The only recommendation I have is to include an additional code line after the message function code you provided in your documentation. While you do reference the cat function you should also have the actual code that supports the reference to the function made:
So, the documented line should be changed from: print bionic text as message or cat message(genbt)
To:
print bionic text using either the message or cat functions message(genbt) cat(genbt)
Fair point. Initially, I did not include the cat() based on a previous feedback I got from the CRAN team on a previous submission
"It is more R like to generate objects that can be used to extract the information a user is interested in, and then print() that object. Instead of print()/cat() rather use message()/warning() or if(verbose)cat(..) (or maybe stop()) if you really have to write text to the console. (except for print, summary, interactive functions)"
However, going back to read the above, I figure that provided we include the verbose logical statement, then it is okay to use that. I have made changes to the function and the documentation.
Maybe you can take a look when you get a chance.
Obi, I would encourage you to reconsider anything a CRAN team may be telling you regarding our functions. To that team, I would counter argue that 1) bionic text is a significant exception to any of their rules on how they think a function should be constructed, and 2) the cat function suggestion is not made a part of the function itself but is a supporting capability that enhances the function's output.
I have tested the latest update you've made to the bionic_txt function and I personally like the way you had structured the function before the latest modification. Adding the verbose argument sufficiently complicates the function such that I can see many users not being able to draw the connection that to store the bionic text in a separate data variable requires the verbose argument to be FALSE. That is not an intuitive action to initiate. Make sure you document that!
Secondly, the code (unless I'm missing something here) has now been sufficiently "hidden" from the user who might otherwise be interested in learning how the bionic text was actually generated.
Be cautious when a dev team tells you how to construct your functions. If you know what you are doing, you can quickly discern whether the feedback has any merit or not. If I'm understanding their critique correctly, they don't understand just how unique the bionic_txt function truly is.
In any event, I don't like the current changes. However, if you are in a position where the CRAN team will not approve your package submission without making their recommended changes, then I guess you have to keep the function as it currently is.
I would strongly recommend that the function be modified back to its previous version.
One more comment - Make sure you give credit to the originator of that bionic text code and the ideas supporting them. You may want to provide, for example, the links in your documentation to those who originally developed the idea. See the top of this thread for those links. I provided them originally when I was promoting the idea.
Hey Brice, hope you had a good break yesterday. Tracking back to this function and above comments. I have revised the function and this all set to go!
Awesome!
The bionic_txt function was tested and it passed the tests I executed against it. The two links provided in the References section of the documentation were also tested as to accuracy and they both passed.
The code underlying the bionic_txt function can be easily accessed which passes the test for functional code extraction.
The bionic_txt in its current form looks good!
Great and thanks, Brice!
This function proposes to convert a character vector in R to what is referred to as "bionic text." Inspiration for the inclusion of this function originated from the following article in R-bloggers:
https://www.r-bloggers.com/2023/10/little-useless-useful-r-functions-function-for-faster-reading-with-bionic-reading/
The primary source for the original idea of bionic text:
https://bionic-reading.com/
NOTE: If this function is approved for inclusion in quickcode, acknowledgements should be made by including the links above.
The idea behind bionic text is to computationally bold n number of beginning characters of a word to facilitate accelerated reading. However, this method not only bolds n characters of each word in a text, but is also intended to increase the comprehensiveness of text while improving the speed at which the text is read.
PROPOSED FUNCTION NAME: bionic_txt
FUNCTION STRUCTURE: Only 1 argument called input_text is provided
FUNCTION OUTPUT: Console output only; cannot be saved as a data object
ADDITIONAL FUNCTIONALITY: If it is possible encode the function to facilitate saving the bionic text in its modified form, that should be considered.
The following skeleton code is provided in support of this function:
function(input_text){
}
words <- unlist(strsplit(input_text, " "))
modified_words <- sapply(words, modify_word)
formatted_text <- paste(modified_words, collapse = " ")
cat(formatted_text, "\n")
}
FUNCTION USE CASE EXAMPLE:
library(pkgsearch)
newpkg = cran_new(from = 3)
prim_pkg_info = newpkg[, c("Date/Publication", "Package", "Version", "Title", "Description")]
prim_pkg_info$"Date/Publication" = as.Date(prim_pkg_info$"Date/Publication")
txt = prim_pkg_info[4,5]
bionic_txt(txt)