Hello everyone

 

I have a couple of questions about the usage of the R function
"read.table(.)". My point of departure is that I want to import a matrix
(consisting of time and daily stock returns of many stocks) in R. Most of
the data is numeric, however some values are missing (blanks) and in other
cases I have the character "#DIV/0!" (from excel). My goal is to do some
regression analysis with this matrix. My questions now are the following
ones:

 

1.       How can I in general tell R to automatically replace some specific
numbers or characters in tables by others? (for example to replace all
characters "#DIV/0!" by the number 0 or simply "NA")

2.       How can I tell R to fill blanks with a number 0 or "NA"?

3.       How can I tell R to omit the "NA" fields in the calculations but
not the whole row or column? (I realized that the function "na.omit" omits
the whole row)

 

Many thanks for your help!

 

Sincerely,

Samir


        [[alternative HTML version deleted]]

______________________________________________
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