[R] Output from unix PS

Sarah Goslee sarah.goslee at gmail.com
Fri Aug 16 14:31:00 CEST 2013


You don't tell us your OS details or provide an actual reproducible
example, but the error suggests that COMMAND is not one of the column
names in your data frame.

Have you checked that? When I run ps on my Fedora system, the column
name is CMD and not COMMAND.

Sarah

On Fri, Aug 16, 2013 at 7:30 AM,  <mohan.radhakrishnan at polarisft.com> wrote:
> Hi,
>
> When I view this output from the unix command ''ps'' the columns seem to
> properly aligned but it is not read properly into the data frame. The
> aggregate function throws
>
> Error in aggregate.data.frame(data, by = list(COMMAND), FUN = sum) :
>   object 'COMMAND' not found
>
> Is there a recomendation to massage this ?
>
> data = read.table("D:\\p..txt",sep="\t")
>
> agg<-aggregate(data,by=list(COMMAND),FUN=sum)
>
> 68        4524  0.0  0.0  12348   872 ?        S    Aug09   0:00
> hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
> 68        4528  0.0  0.0  12348   860 ?        S    Aug09   0:00
> hald-addon-keyboard: listening on /dev/input/event1
> 68        4532  0.0  0.0  12348   864 ?        S    Aug09   0:00
> hald-addon-keyboard: listening on /dev/input/event0
> root      4540  0.0  0.0  10256   704 ?        S    Aug09   1:02
> hald-addon-storage: polling /dev/sr0
> root      4576  0.0  0.0   8540   492 ?        Ss   Aug09
> 0:00 /usr/bin/hidd --server
> root      4619  0.0  0.0 122008  1540 ?        Ssl  Aug09   0:00 automount
> root      4636  0.0  0.0  26348   524 ?        Ss   Aug09   0:00 ./hpiod
> root      4641  0.0  0.0 154876  6428 ?        S    Aug09
> 0:00 /usr/bin/python ./hpssd.py
> root      4654  0.0  0.0  63544  1212 ?        Ss   Aug09
> 0:00 /usr/sbin/sshd
> root      4663  0.0  0.0 134208  2744 ?        Ss   Aug09   0:00 cupsd
> root      4677  0.0  0.0  21668   896 ?        Ss   Aug09   0:00 xinetd
> -stayalive -pidfile /var/run/xinetd.pid
> root      4695  0.0  0.0  66968  2324 ?        Ss   Aug09   0:00 sendmail:
> accepting connections
> smmsp     4703  0.0  0.0  57716  1760 ?        Ss   Aug09   0:00 sendmail:
> Queue runner at 01:00:00 for /var/spool/clientmqueue
> root      4713  0.0  0.0   6480   372 ?        Ss   Aug09   0:00 gpm
> -m /dev/input/mice -t exps2
>
> Thanks.
>
>
>
-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list