Analysis in R: Easy file naming? The “filenamer” package.

RAnalytics
スポンサーリンク

The “filenamer” package can be useful for creating filenames in R. Commands such as “insert” to insert a string into the filename and “set_fext” to change only the extension can be useful.

As an added bonus, here is a command to specify the working folder in the GUI.

Package version is 0.2.3. Checked with R version 4.2.2.

スポンサーリンク

Install Package

Run the following command.

#Install Package
install.packages("filenamer")

Example

See the command and package help for details.

#Loading the library
library("filenamer")

#Create file name:filename command
#Output in "filename" class
#Designation of extensions:ext option
f <- filename("TEST", ext = "csv")

#"filename" class to text:tag command
tag(f)
[1] "TEST.csv"

#Insert string in file name:insert command
#Specification of string:tag command
Finsert <- insert(f, tag = "TEST2")
tag(Finsert)
[1] "TEST_TEST2.csv"

#Change file extension:set_fext command
Ffext <- set_fext(f, "pdf")
tag(Ffext)
[1] "TEST.pdf"

#bonus
#Specify working folders via GUI
library("tcltk")
FoldPath <- paste(as.character(tkchooseDirectory(title = "Select Folder"), sep = "", collapse =""))

I hope this makes your analysis a little easier !!

Amazon audibleの登録の紹介

プライム会員限定で2024年7月22日まで3か月無料体験キャンペーン開催中です。無料体験後は月額1,500円で聞き放題です。なお、聞き放題対象外の本はAudible会員であれば非会員価格の30%引きで購入することが可能です。

Amazon audibleはプロのナレーターが朗読した本をアプリで聞くことができるサービスで、オフライン再生も可能です。通勤や作業のお供にAmazon audibleのご登録はいかがでしょうか。

・AmazonのAudible

https://amzn.to/3L4FI5o

Copied title and URL