diff options
author | jranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb> | 2010-05-18 12:58:38 +0000 |
---|---|---|
committer | jranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb> | 2010-05-18 12:58:38 +0000 |
commit | 16f5b1d3c0136413e92b2be0f20d365e92e9cd1c (patch) | |
tree | edab7b27ba4253b9dd45520e504c54851f65f26f /R/mkin_long_to_wide.R | |
parent | 30cbb4092f6d2d3beff5800603374a0d009ad770 (diff) |
Much more complete version that was just submitted to CRAN.
git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@9 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
Diffstat (limited to 'R/mkin_long_to_wide.R')
-rw-r--r-- | R/mkin_long_to_wide.R | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/R/mkin_long_to_wide.R b/R/mkin_long_to_wide.R new file mode 100644 index 00000000..45ee0a10 --- /dev/null +++ b/R/mkin_long_to_wide.R @@ -0,0 +1,9 @@ +mkin_long_to_wide <- function(long_data, time = "time")
+{
+ colnames <- unique(long_data$name)
+ wide_data <- data.frame(time = subset(long_data, name == colnames[1], time))
+ for (var in colnames) {
+ wide_data[var] <- subset(long_data, name == var, value)
+ }
+ return(wide_data)
+}
|