0

I have a data frame which I have created through a series of pipelines but did not start with an assignment <-. This is because I am working interactivly in rmarkdown and want to include the final result in the repport without having to call print on the object. So this is how the data looks:

df <- structure(list(n = c("1", "2", "3", "4", NA), 
                      nn = c(14695L, 4304L, 264L, 36L, 19299L)),
                 .Names = c("n", "nn"), row.names = c(NA, -5L), 
                 class = c("tbl_df", "tbl", "data.frame"))

print(df)
# A tibble: 5 x 2
  n        nn
  <chr> <int>
1 1     14695
2 2      4304
3 3       264
4 4        36
5 <NA>  19299 

I would like to change the NA in a pipeline instead of making an assignment as bellow which requires me to save the object and find a name for it...

df[5, 1] <- "Sum". 

After this adjustment I am goint to pipe the result in kable. How can I achive this? Thanks

xhr489
  • 1,957
  • 13
  • 39

0 Answers0