[R] Replacing N.A values in a data frame

Gabor Grothendieck ggrothendieck at gmail.com
Fri Oct 15 00:59:09 CEST 2010


On Thu, Oct 14, 2010 at 9:59 AM, Santosh Srinivas
<santosh.srinivas at gmail.com> wrote:
> Wow! That’s Amazing! Many thanks!
>
> When I do the below ... why do the column names get thrown off? Ticker is a
> factor / character ... I tried both
>
>> temp <- head(MF_Data_Sub)
>> temp
>        Date Ticker   Price
> 1 2008-04-01 106270 10.3287
> 2 2008-04-01 106269 10.3287
> 3 2008-04-01 102767 12.6832
> 4 2008-04-01 102766 10.5396
> 5 2008-04-01 102855  9.7833
> 6 2008-04-01 102856 12.1485
>> tZoo <- read.zoo(temp,split=2)
>> tZoo
>           X102766 X102767 X102855 X102856 X106269 X106270
> 2008-04-01 10.5396 12.6832  9.7833 12.1485 10.3287 10.3287

It automatically makes the names valid variable names for R as does
data.frame in R.  If you do not want that behavior add the check.names
= FALSE argument to read.zoo .

> Also, is there an easy way to do a return profile on the data below after it
> is transformed?
>

What is a "profile on the data"?   These all work: str(z); summary(z); View(z)

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list