Hi, I could not open the file.
Can you load the data into R and then use the dput function?
The first link deals with dput. The latter 2 links are for dealing with
NAs in data.
http://www.inside-r.org/r-doc/base/dput
dput {base}
http://r.789695.n4.nabble.com/subset-without-removing-NAs-td3482011.html
R help - subset without removing NAs
http://stackoverflow.com/questions/2613420/handling-missing-incomplete-d
ata-in-r-is-there-function-to-mask-but-not-remove
Handling missing/incomplete data in R--is there function to mask but not
remove NAs? - Stack Overflow
Thank you.
Irucka
<-----Original Message-----> >From: elvina [via R] [ml-node+s789695n4665877h63@n4.nabble.com]
>Sent: 4/30/2013 6:55:52 PM
>To: iruckaE@mail2world.com
>Subject: Re: log returns, error
>
>Thank you for an advice! I read the answers, but I am still confused
about how to present files.... >The link is the data I use - stock price. Some of the numbers are NA,
so it says log is not meaningful for >factors. How can I make him not to count them?
>http://www.file-upload.net/download-7537530/daily.csv.html
>
>############################
>data <- read.csv("daily.csv", sep=",")
>data
>#Step 1: Daily Log Returns
>daily_ret <- NULL
>for (i in c(2:ncol(data))){
> subsample <- data[ ,i]
> daily_ret_subsample <- diff(log(subsample))
> daily_ret <- cbind(daily_ret, daily_ret_subsample)
>}
>daily_ret <- cbind(tail(x=data[ ,1], n=nrow(daily_ret)), daily_ret)
>colnames(daily_ret) <- colnames(data)
>daily_ret <- as.data.frame(daily_ret)
>daily_ret
> ####################################
>
>
>
>
>If you reply to this email, your message will be added to the
discussion below:>http://r.789695.n4.nabble.com/log-returns-error-tp4665865p4665877.html
>To unsubscribe from log returns, error, click here.
>NAML
<span id=m2wTl><p><font face="Arial, Helvetica,
sans-serif" size="2"
style="font-size:13.5px">_______________________________________________________________<BR>Get
the Free email that has everyone talking at <a href=http://www.mail2world.com
target=new>http://www.mail2world.com</a><br> <font
color=#999999>Unlimited Email Storage – POP3 – Calendar
– SMS – Translator – Much
More!</font></font></span>
[[alternative HTML version deleted]]