## Here is a plot. The input was parsed with Jim Holtman's code. ## The panel.dumbell is something I devised to show differences.
## Rich input <- readLines(textConnection(" Private + Shared = RAM used Program 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd 108.0 KiB + 12.5 KiB = 120.5 KiB klogd 124.0 KiB + 17.0 KiB = 141.0 KiB hidd 116.0 KiB + 30.0 KiB = 146.0 KiB acpid 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage 144.0 KiB + 15.0 KiB = 159.0 KiB gpm 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check --------------------------------------------------------- 453.9 MiB ================================= Private + Shared = RAM used Program 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd 108.0 KiB + 12.5 KiB = 120.5 KiB klogd 124.0 KiB + 17.0 KiB = 141.0 KiB hidd 116.0 KiB + 30.0 KiB = 146.0 KiB acpid 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage 144.0 KiB + 15.0 KiB = 159.0 KiB gpm 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check ---------------------------------------------------------- 453.9 MiB =================================")) # keep only the data input <- input[grepl('=', input)] # separate into groups grps <- split(input, cumsum(grepl("= RAM", input))) # parse the data (not sure if there is also 'MiB') parsed <- lapply(grps, function(.grp){ # parse ignoring first and last lines .data <- sub(".*= ([^ ]+) ([^ ]+)\\s+(.*)", "\\1 \\2 \\3" , .grp[2:(length(.grp) - 1L)] ) # return matrix do.call(rbind, strsplit(.data, ' ')) }) parsed tmp1 <- do.call(rbind, lapply(parsed, function(x) data.frame(x))) names(tmp1) <- c("RamUsed", "units", "Program") tmp1$Time <- factor(rep(1:2, each=7)) tmp1$RamUsed <- as.numeric(tmp1$RamUsed) library(lattice) dotplot(Program ~ RamUsed, groups=Time, data=tmp1) ## this is silly. Let me construct a more interesting example with different values at each time. tmp1$RamUsed[8:14] <- tmp1$RamUsed[1:7] + 10*(sample(1:7)) tmp1 dotplot(Program ~ RamUsed, groups=Time, data=tmp1, auto.key=list(title="Time", border=TRUE, columns=2)) panel.dumbell <- function(x, y, ..., lwd=1) { n <- length(x)/2 panel.segments(x[1:n], as.numeric(y)[n+(1:n)], x[n+(1:n)], as.numeric(y)[n+(1:n)], lwd=lwd) panel.dotplot(x, y, ...) } dotplot(Program ~ RamUsed, groups=Time, data=tmp1, auto.key=list(title="Time", border=TRUE, columns=2), panel=panel.dumbell, par.settings=list(superpose.symbol=list(pch=19)), ) On Fri, Aug 30, 2013 at 9:44 AM, jim holtman <jholt...@gmail.com> wrote: > Here is how to parse the data and put it into groups. Not sure what > the 'timing' of each group is since not time information was given. > Also not sure is there is an 'MiB' qualifier on the data, but you have > the matrix of data which is easy to do with as you want. > > > > input <- readLines(textConnection(" > + Private + Shared = RAM used Program > + > + 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd > + 108.0 KiB + 12.5 KiB = 120.5 KiB klogd > + 124.0 KiB + 17.0 KiB = 141.0 KiB hidd > + 116.0 KiB + 30.0 KiB = 146.0 KiB acpid > + 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage > + 144.0 KiB + 15.0 KiB = 159.0 KiB gpm > + 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check > + --------------------------------------------------------- > + 453.9 MiB > + > + ================================= > + Private + Shared = RAM used Program > + > + 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd > + 108.0 KiB + 12.5 KiB = 120.5 KiB klogd > + 124.0 KiB + 17.0 KiB = 141.0 KiB hidd > + 116.0 KiB + 30.0 KiB = 146.0 KiB acpid > + 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage > + 144.0 KiB + 15.0 KiB = 159.0 KiB gpm > + 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check > + ---------------------------------------------------------- > + 453.9 MiB > + =================================")) > > > > # keep only the data > > input <- input[grepl('=', input)] > > > > # separate into groups > > grps <- split(input, cumsum(grepl("= RAM", input))) > > > > # parse the data (not sure if there is also 'MiB') > > parsed <- lapply(grps, function(.grp){ > + # parse ignoring first and last lines > + .data <- sub(".*= ([^ ]+) ([^ ]+)\\s+(.*)", "\\1 \\2 \\3" > + , .grp[2:(length(.grp) - 1L)] > + ) > + # return matrix > + do.call(rbind, strsplit(.data, ' ')) > + }) > > > > > > > > parsed > $`1` > [,1] [,2] [,3] > [1,] "107.5" "KiB" "uuidd" > [2,] "120.5" "KiB" "klogd" > [3,] "141.0" "KiB" "hidd" > [4,] "146.0" "KiB" "acpid" > [5,] "153.5" "KiB" "hald-addon-storage" > [6,] "159.0" "KiB" "gpm" > [7,] "162.5" "KiB" "pam_timestamp_check" > > $`2` > [,1] [,2] [,3] > [1,] "107.5" "KiB" "uuidd" > [2,] "120.5" "KiB" "klogd" > [3,] "141.0" "KiB" "hidd" > [4,] "146.0" "KiB" "acpid" > [5,] "153.5" "KiB" "hald-addon-storage" > [6,] "159.0" "KiB" "gpm" > [7,] "162.5" "KiB" "pam_timestamp_check" > > > > Jim Holtman > Data Munger Guru > > What is the problem that you are trying to solve? > Tell me what you want to do, not how you want to do it. > > > On Fri, Aug 30, 2013 at 7:24 AM, <mohan.radhakrish...@polarisft.com> > wrote: > > Hi, > > I haven't tried the code yet. Is there a way to parse this data > > using R and create bar plots so that each program's 'RAM used' figures > are > > grouped together. > > So 'uuidd' bars will be together. The data will have about 50 sets. So if > > there are 100 processes each will have about 50 bars. > > > > What is the recommended way to graph these big barplots ? I am looking > for > > only 'RAM used' figures. > > > > > > Thanks, > > Mohan > > > > > > Private + Shared = RAM used Program > > > > 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd > > 108.0 KiB + 12.5 KiB = 120.5 KiB klogd > > 124.0 KiB + 17.0 KiB = 141.0 KiB hidd > > 116.0 KiB + 30.0 KiB = 146.0 KiB acpid > > 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage > > 144.0 KiB + 15.0 KiB = 159.0 KiB gpm > > 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check > > --------------------------------------------------------- > > 453.9 MiB > > > > ================================= > > Private + Shared = RAM used Program > > > > 96.0 KiB + 11.5 KiB = 107.5 KiB uuidd > > 108.0 KiB + 12.5 KiB = 120.5 KiB klogd > > 124.0 KiB + 17.0 KiB = 141.0 KiB hidd > > 116.0 KiB + 30.0 KiB = 146.0 KiB acpid > > 124.0 KiB + 29.5 KiB = 153.5 KiB hald-addon-storage > > 144.0 KiB + 15.0 KiB = 159.0 KiB gpm > > 136.0 KiB + 26.5 KiB = 162.5 KiB pam_timestamp_check > > ---------------------------------------------------------- > > 453.9 MiB > > ================================= > > > > > > This e-Mail may contain proprietary and confidential information and is > sent for the intended recipient(s) only. If by an addressing or > transmission error this mail has been misdirected to you, you are requested > to delete this mail immediately. You are also hereby notified that any use, > any form of reproduction, dissemination, copying, disclosure, modification, > distribution and/or publication of this e-mail message, contents or its > attachment other than by its intended recipient/s is strictly prohibited. > > > > Visit us at http://www.polarisFT.com > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.