[R] save() and load()

AbouEl-Makarim Aboueissa @boue|m@k@r|m1962 @end|ng |rom gm@||@com
Tue Sep 26 03:23:01 CEST 2023


Dear ALL:

I am teaching statistical packages class this semester, in R programing I
am trying to explain the use of save() and load() with an example using the
iris data. It seems that the save() function works, BUT when I tried to
load the data back to R, it seems that there is a problem(s), I could not
figure out what went wrong.

Any help would be highly appreciated.


I saved the iris data in my computer in the text format, "iris.with.head.txt
".

Here are my R codes:

> irisdata<-read.table("G:/iris.with.head.txt", header=T)
>
> head(irisdata)
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1          5.1         3.5          1.4         0.2  setosa
2          4.9         3.0          1.4         0.2  setosa
3          4.7         3.2          1.3         0.2  setosa
4          4.6         3.1          1.5         0.2  setosa
5          5.0         3.6          1.4         0.2  setosa
6          5.4         3.9          1.7         0.4  setosa



*##### saving the data as an .rda*

save(irisdata,file="G:/irisdataTest.rda")

*##### load the data back to R*

load(file="G:/irisdataTest.rda")


>head(irisdataTest)
Error in head(irisdataTest) : object 'irisdataTest' not found

> irisdataTest
Error: object 'irisdataTest' not found



with many thanks
abou
______________________


*AbouEl-Makarim Aboueissa, PhD*

*Professor, Mathematics and Statistics*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*

	[[alternative HTML version deleted]]



More information about the R-help mailing list