Тёмный

Save & Load RData Workspace Files in R (3 Examples) | save(), save.image(), and saveRDS() Functions 

Statistics Globe
Подписаться 30 тыс.
Просмотров 12 тыс.
50% 1

How to save and load data from and to R in the R programming language. More details: statisticsglob...
R code of this video:
data_1 <- c(4, 1, 8, 10, 15) # Create simple example data
data_2 <- 5 # Create another data object
data_3 <- "Hello R User" # Create a third data object
setwd("C:/Users/Joach/Desktop/my directory") # Set working directory
save.image("all_data.RData") # Save entire workspace to directory
load("all_data.RData") # Load workspace back to RStudio
save(data_1, data_2, # Save multiple data objects to directory
file = "data_1_and_2.RData")
load("data_1_and_2.RData") # Load workspace back to RStudio
saveRDS(data_1, # Save single data object to directory
file = "single_data_object.RData")
data_1_reloaded <- readRDS("single_data_object.RData") # Load workspace back to RStudio
Follow me on Social Media:
Facebook - Statistics Globe Page: / statisticsglobecom
Facebook - Group for Discussions & Questions: / statisticsglobe
LinkedIn - Statistics Globe Page: / statisticsglobe
LinkedIn - Group for Discussions & Questions: / 12555223
Twitter: / joachimschork
Music by bensound.com

Опубликовано:

 

13 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 33   
@rajudey1673
@rajudey1673 9 месяцев назад
Than you very much sir for your great work....Nice explanation.
@matthias.statisticsglobe
@matthias.statisticsglobe 9 месяцев назад
That's great to hear, thank you very much for the feedback!
@RamonHernandez-r9t
@RamonHernandez-r9t 10 месяцев назад
Great job! Great tutorial video1 Thanks, Joachim.
@matthias.statisticsglobe
@matthias.statisticsglobe 10 месяцев назад
Hey Ramon, thank you very much for the positive feedback! Glad you like it!
@alicediscovertheworld
@alicediscovertheworld Год назад
Great tutorial ! Thank you very much !
@matthias.statisticsglobe
@matthias.statisticsglobe Год назад
Hi Alice, Thanks a lot for the wonderful response, I’m happy to hear that you like our instructions.
@RoungYul
@RoungYul 2 года назад
Dear Joachim, Thanks for the great work! Could you please guide me on how to find the performance of the Bayesian Moving Average control chart using Posterior distribution through ARL and SDRL as performance measures with the help of Monte Carlo Simulations?
@StatisticsGlobe
@StatisticsGlobe 2 года назад
Hey, thanks a lot for the kind words! Unfortunately, I'm not an expert on this topic. In case you have questions on this topic, you may ask in the Statistics Globe Facebook group. This way, others can contribute/read as well: facebook.com/groups/statisticsglobe
@alioubarry6664
@alioubarry6664 Год назад
Good job ! Thanks a lot Professor
@matthias.statisticsglobe
@matthias.statisticsglobe Год назад
Hi Aliou, thanks for the compliment! Hope the video was helpful!
@haraldurkarlsson1147
@haraldurkarlsson1147 2 года назад
I like the topic and I have seen this sort of thing before but I have often being unsure as to why someone is giving the data in this manner rather than a simple txt or csv file. I guess you are not saving a particular file but might be saving the entire global environment? Can you clarify? Thanks.
@StatisticsGlobe
@StatisticsGlobe 2 года назад
Hey Haraldur, you may either save certain elements or the entire environment. This can not only be used to save data sets, but also to save functions, vector objects etc. Hence, this method is more flexible.
@PostImperfect
@PostImperfect Год назад
I have a data set that required me to delete two questions (I was running EFA for an assignment). Given the original data set was randomly generated from a massive df, I cannot easily go back to the original set. Hope this makes sense?
@PostImperfect
@PostImperfect Год назад
Thanks for another great explanation - I really value your work :) Unfortunately, this didn't exactly work for me. I thought that maybe it was a problem with the location of my wd, so I changed it to my desktop and received this error "Error: '\U' used without hex digits in character string starting ""C:\U"". So I tried just saving it using this code: saveRDS(my.data_noQ16_noQ10, file = "my.data_noQ16_noQ10.RData") myEFAdata
@cansustatisticsglobe
@cansustatisticsglobe Год назад
Hello! It is possible that you receive this error since you are trying to load the RMD file, not an RData file. RMD files are R Markdown documents that contain a mix of text and code chunks. They are intended for reporting and can be rendered into various output formats like HTML, PDF, or Word using the markdown package. They are not like Rdata files, which store R objects such as data frames, matrices, etc. Hence, make sure that you have the right file extension while using the load() function. Regards, Cansu
@amirteimourpour1144
@amirteimourpour1144 2 года назад
Thank you 👍
@StatisticsGlobe
@StatisticsGlobe 2 года назад
You are welcome Amir! :)
@adarsh6025
@adarsh6025 Год назад
When I am trying to save my workspace. It shows that "first argument should be an image". Could you please tell me what should I do?
@StatisticsGlobe
@StatisticsGlobe Год назад
Sorry for my late response, Adarsh! I've been on vacation... Do you still have trouble with the problem?
@ZeeNoorTrip
@ZeeNoorTrip 2 года назад
Hi can you make a video sooner if you make svm model in R and apply up, down and smote for that model?
@StatisticsGlobe
@StatisticsGlobe 2 года назад
Hey, unfortunately I'm not an expert on this topic. In case you have questions on this topic, you may ask in the Statistics Globe Facebook group. This way, others can contribute/read as well: facebook.com/groups/statisticsglobe
@ZeeNoorTrip
@ZeeNoorTrip 2 года назад
@@StatisticsGlobe still ok. As the Facebook link still very helpful
@StatisticsGlobe
@StatisticsGlobe 2 года назад
Glad you like the group! :)
@vicentefigueroatocornal2776
@vicentefigueroatocornal2776 2 года назад
You're a machine
@matthias.statisticsglobe
@matthias.statisticsglobe Год назад
Thanks for the feedback Vicente! Glad you like our way of machine learning ;)
@Hassan_MM.
@Hassan_MM. Год назад
Hi❤ can we Modify inbuilt Datasets in R ❓️❓️
@cansustatisticsglobe
@cansustatisticsglobe Год назад
Hello, I was on vacation. That's why I couldn't respond earlier. You should be able to use the given code also for built-in datasets. Best, Cansu
@Hassan_MM.
@Hassan_MM. Год назад
@cansustatisticsglobe I mean which 📂 folder of R to Edit,so that I can have my personalised Datasets as inbuilt ones ❗️
@cansustatisticsglobe
@cansustatisticsglobe Год назад
Hello @@Hassan_MM., Do you like to create an R package where you can find your data as you find a built-in dataset? I am not sure if I get you well. Could you please give some more details? Best, Cansu
@Hassan_MM.
@Hassan_MM. Год назад
@cansustatisticsglobe Ya❗️ at least can I edit any Existing Package for the same
@cansustatisticsglobe
@cansustatisticsglobe Год назад
Hello @@Hassan_MM., Creating a package in R involves several steps. Below is a basic step-by-step guide to creating a package that allows you to access user datasets as if they were built-in ones. Let's assume you have a dataset named mydata and you want to include it in a package named mypackage. Setup: First, make sure you have the required tools installed. This typically means installing the devtools and usethis packages: install.packages(c("devtools", "usethis")) library(devtools) library(usethis) Create a New Package: Create a new package structure in your desired directory. create_package("~/mypackage") Documenting the Package: This step involves creating the necessary documentation for your package, so it's recognized by R and can be installed. Use the roxygen2 package to help with this. use_roxygen_md() Add Your Dataset: Save your dataset as an .RData file inside the data directory of the package you've just created: use_data(mydata, overwrite = TRUE) Document Your Dataset: It's good practice to document your datasets so users (including future you) know what they're about. use_r("mydata") This will open a script. Document your data following roxygen2 conventions. Build & Install: Now, you'll build and install your package: install("~/mypackage") Load Your Package and Access Your Dataset: After building and installing, you can now load your package like any other in R: library(mypackage) data(mydata) These are what I found after research, but please remember that creating a robust, full-fledged R package involves more steps, such as writing unit tests, maintaining version control with Git and GitHub, and more. Best, Cansu
Далее
If-else statements in R
12:29
Просмотров 4,3 тыс.
ЧТО ВЫРОСЛО ОТ КОКА КОЛЫ😱#shorts
00:26
ТИПИЧНОЕ ПОВЕДЕНИЕ МАМЫ
00:21
Просмотров 891 тыс.
Creating & Saving an R Script
6:04
Просмотров 17 тыс.
Describe and Summarise your data
19:44
Просмотров 55 тыс.
Lubridate - how to manipulate date and time data in R
18:05
R - Saving and Closing R
7:15
Просмотров 45 тыс.
Loading, Viewing, working with an R dataset (basics)
11:21