Hi:

I am trying to understand the link between ".csv" and ".rda" files. Is there any easy to follow tutorial on this?

(I could do some of the operations below, but I got lost in the details.)

1.  Reading .rda file ?

data <- load("profit.rda") # supposed to have four variable --y x1 x2 state_name

--how do I find out about the variable names,
--take the log of y and x1
--extract y and calculate mean etc..

(I want to use it in lm regression lny = f(lnx1,x2))

****************

2. How could I save this profit.rda file as a csv file with the variable names attached?
I tried doing this:

profit_data <- load("profit.rda")

#Could I do this?
write.csv(profit_data, file="profit.csv", col.names=TRUE)
data2 <- read.csv("profit.csv", head = TRUE)

# saving .rda file without the header?
write.csv(profit_data, file="profit2.csv", col.names=FALSE)

***********

3. Creating a .rda file  from a csv file  using the save command

data2 <- read.csv("poverty.csv", head = T, sep = ",") # poverty.csv file has 4 variables -- Q L K country_name
save(data2, file="poverty.rda")

--How do I  attach names from the csv file to this .rda file?



Best,
Alok Bohara
UNM

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to