Multiplying all columns in dataframe by single column

前端 未结 5 623
情书的邮戳
情书的邮戳 2020-12-21 02:10

I know it is a basic quaestion but couldnt find any solution to it. I want to multiply all columns of a dataframe by single column.

df1<-data.frame(F1=c(1         


        
5条回答
  •  青春惊慌失措
    2020-12-21 02:36

    Another solution is sweep(df1, 1, C$C, `*`), which means "sweep out" the statistic represented by C$C from each column of df1 by multiplication.

提交回复
热议问题