Data Science Desktop Survival Guide by Graham Williams Desktop Survival Project Home Preface Data Science Introducing R R Constructs R Tasks R Strings R Read, Write, and Create Data Template Data Exploration Data Wrangling Data Visualisation Statistics ML Template ML Scenarios ML Activities ML Applications ML Algorithms Cluster Analysis Decision Trees Computer Vision Graph Data Privacy Literate Data Science Coding with Style Resources Bibliography Index

## Assignment

20200105

resume
Avoid using base::= for assignment. It was introduced in S-Plus in the late 1990s as a convenience but is ambiguous (named arguments in functions, mathematical concept of equality). The traditional backward assignment operator base:: - implies a flow of data and for readability is explicit about the intention.

Preferred

 a <- 42 b <- mean(x) Discouraged
 a = 42 b = mean(x) The forward assignment base::- should generally be avoided. A single use case justifies it in pipelines where logically we do an assignment at the end of a long sequence of operations. As a side effect operator it is vitally important to highlight the assigned variable whenever possible and so out-denting the variable after the forward assignment to highlight it is recommended. Preferred
 ds[vars] %>%   sapply(function(x) all(x == x[1L])) %>%   which() %>%   names() %T>%   print() -> constants Traditional
 constants <-   ds[vars] %>%   sapply(function(x) all(x == x[1L])) %>%   which() %>%   names() %T>%   print() Discouraged
 ds[vars] %>%   sapply(function(x) all(x == x[1L])) %>%   which() %>%   names() %T>%   print() ->   constants
{"ft_lang_label":"__label__en","ft_lang_prob":0.6702068,"math_prob":0.9336233,"size":860,"snap":"2021-31-2021-39","text_gpt3_token_len":233,"char_repetition_ratio":0.101635516,"word_repetition_ratio":0.22727273,"special_character_ratio":0.3127907,"punctuation_ratio":0.03731343,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.986442,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,null,null,null,null,2,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-17T07:32:40Z\",\"WARC-Record-ID\":\"<urn:uuid:a3989b63-9a02-441a-8a67-8a4f4121f5a0>\",\"Content-Length\":\"13388\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cb196557-da54-4839-a428-5064b994c0d0>\",\"WARC-Concurrent-To\":\"<urn:uuid:7109820b-c906-4df5-b547-53eb8029c4fa>\",\"WARC-IP-Address\":\"209.58.165.79\",\"WARC-Target-URI\":\"https://onepager.togaware.com/Assignment.html\",\"WARC-Payload-Digest\":\"sha1:53ZXAASISFB7QMNNOO63TVDSP55UUJ3Y\",\"WARC-Block-Digest\":\"sha1:WX3M7HYMJYP3JL36U3ZD4NWKFQZS6PHT\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780055601.25_warc_CC-MAIN-20210917055515-20210917085515-00467.warc.gz\"}"}