日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

centos有趣软件包_这5个软件包使学习R变得有趣

發布時間:2023/12/15 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos有趣软件包_这5个软件包使学习R变得有趣 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

centos有趣軟件包

Sometimes, it’s easy to get frustrated when learning programming. Perhaps you’ve been working on the same concept for an hour or two. Perhaps your progress is slow. Perhaps this is all happening at 6pm on a Friday in the middle of a global pandemic. I’ve been there, and I imagine I’m not alone.

有時,在學習編程時很容易感到沮喪。 也許您已經在同一個概念上研究了一兩個小時。 也許您的進度很慢。 也許這一切都是在全球大流行期間的星期五下午6點發生的。 我去過那里,我想我并不孤單。

Thankfully for R programmers, there are packages that help bring joy back into the learning process. What’s?more, they’re easy to understand and can make amusing additions to recreational projects.

值得慶幸的是,對于R程序員,有一些軟件包可以使學習過程重新獲得歡樂。 而且,它們很容易理解,并且可以為娛樂項目添加有趣的內容。

Below, I’ve put together five of my favourite ‘just for fun’ R packages. Each example is very beginner friendly, though make sure you install each package before running the example?code. You can do this by running the function install.packages("packagenamehere") for each example, changing the package name to one of those listed below.

下面,我整理了五個我最喜歡的“只是為了娛樂” R程序包。 每個示例對初學者都非常友好,但是請確保在運行示例代碼之前先安裝每個軟件包。 您可以通過為每個示例運行功能install.packages("packagenamehere")并將包名稱更改為以下所列名稱之一來完成此操作。

1.蜂 (1. beepr)

The ‘beepr’ package contains only one function: beep. This plays a sound when called, and comes loaded with some fun notifications. If you ever wanted to to hear a Wilhelm scream or the ‘get item’ sound from the Legend of Zelda in the middle of a script, this is the package for you. It’ll also play sound from a .wav file from the internet if you give it a valid URL. Just call beep with a number or valid URL as an argument, and it’ll play a corresponding sound.

“ beepr ”軟件包僅包含一個功能: beep 。 調用時會播放聲音,并附帶一些有趣的通知。 如果您想在腳本中間聽到《塞爾達傳說》中的威廉尖叫聲或“獲取物品”的聲音,那么此包適合您。 如果您給它提供有效的URL,它還將從Internet的.wav文件中播放聲音。 只需使用數字或有效URL作為參數調用beep ,它就會播放相應的聲音。

library(beepr)# Play Zelda treasure notification
beep(5)
# Play Wilhelm scream
beep(9)

Unlike some of the other packages I mention below, beepr can actually be quite useful in serious work. While running code that takes a long time to execute, I often work on something else while waiting for it to finish. Calling beep at the end of my script signals that my long process is done. It’s pretty satisfying to hear some 8-bit fanfare at the end of a long analysis or simulation.

與下面提到的其他一些軟件包不同,beepr實際上在認真的工作中會非常有用。 在運行需要很長時間才能執行的代碼時,我經常在等待代碼完成的同時進行其他工作。 在腳本末尾調用beep表示我的長過程已經完成。 在長時間的分析或模擬結束時聽到一些8位夸張的聲音,這真是令人滿足。

2.好玩 (2. fun)

The aptly named ‘fun’ package is a collection of miscellaneous functions and games. If you ever needed another vehicle for procrastination, you’ve got one in this package. Notable inclusions are a neat version of minesweeper that runs in an R window, as well as other games like a sliding puzzle, and ‘5 in a row’. Running these games is easy, only requires the code below. After loading the package, the conditional statement opens the right interactive graphics device based on your operating system. You can then start any game from the package (such as the sliding puzzle) by calling its function.

恰當地命名為“ fun ”包是各種功能和游戲的集合。 如果您需要另一種拖延工具,則可以在此工具包中找到。 值得一提的內容是在R窗口中運行的minesweeper的簡潔版本,以及其他游戲,例如滑動拼圖和“連續5個”。 運行這些游戲很容易,只需要下面的代碼。 加載軟件包后,條件語句將根據您的操作系統打開正確的交互式圖形設備。 然后,您可以通過調用包的功能來從包中啟動任何游戲(例如滑動拼圖)。

library(fun)# Open the right interactive graphics device
if (.Platform$OS.type == "windows") {
x11()
} else {
x11(type = "Xlib")
}# Start game of choice (sliding puzzle)
fun::sliding_puzzle()

This package also contains some other miscellaneous features and demos. Ever wanted to draw a turtle in R? Test for Alzheimer’s disease? Shut down your operating system? These are all things you can do with ‘fun’. While bricking your OS might not result in laughter, the many other amusing games and distractions in this package are good fun.

該軟件包還包含其他一些雜項功能和演示。 是否曾經想在R中畫一只烏龜? 測試阿爾茨海默氏病? 關閉操作系統? 這些就是您可以通過“有趣”做的所有事情。 雖然使操作系統變磚可能不會引起歡笑,但此程序包中的許多其他有趣的游戲和令人分心的游戲都很好玩。

3.命運 (3. fortunes)

‘fortunes’ is another package with a sole function; fortune. When called with no arguments, it spits out random nuggets of humour and wisdom from the R-help forums, and other R related sites. To receive a more specific fortune, you can add a string argument to the function call (fortune("divide") for example). This frequently results in some amusing outputs, with one of my favourites below:

“ fortunes ”是另一個具有唯一功能的軟件包; fortune 。 當不加任何參數地被調用時,它會從R-help論壇和其他與R相關的站點中隨機散發出幽默和智慧。 要獲得更具體的財富,您可以在函數調用中添加一個字符串參數(例如fortune("divide") )。 這經常導致一些有趣的輸出,下面是我的最愛之一:

Corinna Schmitt: How can I divide the number 0.285 with 2. I need a function. Result: 0.285 / 2 = 0.1425Gabor Csardi: Well, i think half.of.0.285 <- function() { 0.1425 }would do the trick. -- Corinna Schmitt and Gabor Csardi R-help (April 2007)

Corinna Schmitt:如何將數字0.285除以2。我需要一個函數。 結果:0.285 / 2 = 0.1425Gabor Csardi:嗯,我認為0.285 <-function(){0.1425}的一半會解決問題。 -Corinna Schmitt和Gabor Csardi R-help(2007年4月)

As an added learning?incentive, many quotes get funnier as you find out more about R and its community. But whatever your skill level, fortunes’ selection of humourous asides make for a fun distraction from whatever you’re meant to be doing instead.

作為額外的學習動機,當您進一步了解R及其社區時,許多引號會變得更有趣。 但是,無論您的技術水平如何,財富中選擇的幽默助手都會使您分心,而這本來就是要做什么的。

4. Cowsay (4. cowsay)

A neat package that adds character to text output in the console, ‘cowsay’ lets you print messages that are ‘spoken’ by animals drawn in ASCII characters. Want to soften the blow of a warning message? Make a cat say it with the code below.

一個很好的程序包,它在控制臺的文本輸出中添加了字符,“ cowsay ”使您可以打印被ASCII字符繪制的動物“說出”的消息。 想要減輕警告消息的打擊嗎? 用下面的代碼讓貓說出來。

say(what = "Cannot index object of type 'cat food'.", by = "cat", type = "warning")A very cute warning message.一個非常可愛的警告消息。

The say function can also handle messages that aren’t defined as warnings, and defaults to printing normal text. It also integrates with the ‘fortunes’ package; when running say(what = "fortune"), a random fortune will be spoken by an animal. Because everyone wants to see a duck lament the stupidity of R users.

say函數還可以處理未定義為警告的消息,默認情況下為打印普通文本。 它還與“財富”軟件包集成在一起; 當運行say(what = "fortune") ,動物會說出隨機的運氣。 因為每個人都希望看到鴨子對R用戶的愚蠢感嘆。

5.好評 (5. praise)

Finally, it’s just nice to receive a compliment sometimes. The ‘praise’ package facilitates this by generating random praise, allowing you to receive fresh encouragement with each call. Calling praise while specifying parts of speech to dynamically generate with the ${} syntax yields statements like the following:

最后,有時候會受到稱贊是很好的。 “ 稱贊 ”包通過產生隨機稱贊來促進這一點,使您在每次通話時都能得到新鮮的鼓勵。 在指定詞性以使用${}語法動態生成時調用praise會產生如下語句:

praise("${Exclamation}! Kind reader, you're ${adjective}!")Some kind output.某種輸出。

In my example, I capitalised my exclamation, while leaving my adjective in lowercase for grammatical purposes. Dynamically generated phrases can be entirely capitalised for some extra enthusiasm (${EXCLAMATION} , for instance). While I can’t see this gaining traction in many serious production-level scripts, sometimes it’s nice to praise your own efforts. Learned a new analysis today? Sensational work, champ.

在我的示例中,我大寫了感嘆號,同時出于語法目的將形容詞小寫。 動態生成的短語可以完全大寫,以獲得一些額外的熱情(例如${EXCLAMATION} )。 盡管我看不到在許多嚴肅的生產級腳本中如此吸引人,但有時還是值得稱贊您自己的努力。 今天學會了新的分析方法? 聳人聽聞的工作,冠軍。

In our current economic climate, people are mainly learning programming for career development. The concern of the hour is learning techniques that secure jobs, not building projects that bring joy. I don’t think this is completely unreasonable either. After all, most R programmers don’t get paid to make ASCII animals talk to users. They get paid to analyse data.

在當前的經濟形勢下,人們主要是學習編程以發展職業。 時間的關注點是學習技術可以確保工作安全,而不是構建能夠帶來歡樂的項目。 我也不認為這完全是不合理的。 畢竟,大多數R程序員并沒有獲得使ASCII動物與用戶交談的報酬。 他們得到報酬來分析數據。

That said, I like these packages because they reaffirm why I was drawn to programming in the first place. It’s fun, and lets me make?interesting?things. When I first started learning to code, I wasn’t gunning for a high powered job. I was?excited?to?create?fun?small?scale?projects?that?applied?my?new?skills. Even though?I?enjoy?writing code?in?my?career nowadays, it’s nice to get back in touch with that feeling once in a while.

就是說,我喜歡這些軟件包,因為它們重申了為什么我一開始就被編程所吸引。 很好玩,讓我做有趣的事情。 當我剛開始學習編碼時,我并不是在追求高能力的工作。 我很高興創建有趣的小規模項目,這些項目運用了我的新技能。 即使我現在喜歡在職業生涯中編寫代碼,但偶爾與這種感覺重新聯系還是很高興的。

So, in the spirit of fun: say(praise("Thanks for reading, and have fun ${creating} your own ${adjective} R code!"))

因此,本著樂趣的精神: say(praise("Thanks for reading, and have fun ${creating} your own ${adjective} R code!"))

翻譯自: https://towardsdatascience.com/make-learning-r-fun-with-these-5-packages-3c3f6ca82c96

centos有趣軟件包

總結

以上是生活随笔為你收集整理的centos有趣软件包_这5个软件包使学习R变得有趣的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。