Try to search your question here, if you can't find : Ask Any Question Now ?

how to set value for whole row through pipe function

HomeCategory: stackoverflowhow to set value for whole row through pipe function
Avatarjohn asked 4 months ago

I am trying to set the default value for the first row in of the data frame to 1 through the pipe function. As its one of the requirements to dynamically compound the values in the data with the date function. I will appreciate if anyone can help me to understand how I can set the default value for all the 1st rows in below mentioned code. I already created a placeholder where I m expected default value .

df2 <- df %>% mutate(MonthDate = as.Date(df$StartMonth,"%m/%d/%Y")) %>%
  filter(MonthDate > as.Date("2005-09-30"))%>%
  # Place holder where I want to set first row of the column to default value of 1#
  mutate(SAABenchmark_VAMI = cumprod(exp(SAABenchmarkstdev)),
         SAABetaOnly_VAMI = cumprod(exp(SAABetaOnly_stdev)),
         HFbenchmark_VAMI = cumprod(exp(HFbenchmarkReturns)),
         ZAAMHF_VAMI = cumprod(exp(ZAAMHFReturns)))%>%
  mutate(SAABenchmark_logVAMI =log(SAABenchmark_VAMI),
         SAABetaOnly_logVAMI=log (SAABetaOnly_VAMI),
  melt(., id.vars = "MonthDate")
1 Answers
Best Answer
AvatarMannu answered 4 months ago
Your Answer

15 + 20 =

Popular Tags

WP Facebook Auto Publish Powered By :