Skip to content
Back to formatted view

Raw Message

Message-ID: <15692f300803220721v1d745ba9r36c037ece50579c@mail.gmail.com>
Date: 2008-03-22T14:21:42Z
From: Tribo Laboy
Subject: More elegant multiplication or division of a data frame with a vector

Hello,

I am importing some raw voltage multichannel measurements into an R
data frame. I need to scale each column with the respective
sensitivity for that channel. I figured how to do it, but I am curious
if there isn't a more elegant way.

Now I start with something like this:

rawdata <- data.frame(rbind(c(1,2,3), c(4,5,6)))
sens <- c(2,4,6)


and I do this:
data <- as.data.frame(t(t(rawdata)/sens))

Any suggestions?

Cheers,

TL