Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FW: Re: Frequencies function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15214] Re: [mg15180] FW: Re: Frequencies function
  • From: Des Penny <penny at suu.edu>
  • Date: Tue, 22 Dec 1998 04:01:44 -0500
  • Organization: Southern Utah University
  • References: <199812190420.XAA07859@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Debbie:
I tried the following and had no trouble:

In[2]:=
 Needs["Statistics`DataManipulation`"] In[3]:=
?Frequencies
"Frequencies[list] gives a list of the distinct elements in list,
together \ with the frequencies with which they occur." In[4]:=
lis ={1,3,2,5,2,4,1};
In[5]:=
Frequencies[lis]
Out[5]=
{{2,1},{2,2},{1,3},{1,4},{1,5}}
In[6]:=
Frequencies[{a,b,a,a,b,c}]
Out[6]=
{{3,a},{2,b},{1,c}}

If when you executed Frequencies[lis], you got lis back, then
Frequencies must be executing - however it may not be the function that
is contained in the Statistics Package.  Perhaps you have a shadowing
problem here.  If you defined your own function "Frequencies", before
you read in the Statistics package, then your function will be defined
in the Global context and will thus shadow the Frequencies function
just read in.  It may be that your function (Global`Frequencies) is
executing and not the Statistics function
(Statistics`DataManipulation`Frequencies).

The following commands will help you understand what is happening:
$Packages
(This will tell you which packages are loaded.) $ContextPath
(This tells you how Mathematica looks for variables.  Mathematica
searches the current context first  and then searches each context in
$ContextPath.) $Context
(Gives the current context)

Execute
?Frequencies
and
Context[Frequencies]

to give you the information you need with your particular function.

Finally, avoid using << to read in a package.  Use
         Needs["Statistics`DataManipulation`"] instead.  Needs only
reads in a package when it has not been read in before. Some packages
cannot be read-in a second time.

Hope this helps.

Cheers,

Des Penny
Physical Science Dept
Southern Utah University
Cedar City, Utah 84720

Voice: (435) 586-7708
FAX: (435) 865-8051
Email: penny at suu.edu



jim leddon wrote:

> -----Original Message-----
> From:   jim leddon [SMTP:jleddon at cyberramp.net] Sent:   Thursday, December
To: mathgroup at smc.vnet.net
> 17, 1998 6:46 AM To:    'mathgroup at smc.vnet.net'
> Subject: [mg15214]        Re: Frequencies function
>
> Hello,
>
> I am trying to use the 'Frequencies" function under the data
> manipulation package as described below:
>
> in[1]: ClearAll;
>
> in[2]: <<Statistics`DataManipulation`
>
> in[3]: lis ={1,3,2,5,2,4,1};
>
> in[4]: freq = Frequencies[lis]
>
> out[4]: {1,3,2,5,2,4,1}
>
> in essence, I just get a repeat of the data list, "lis". What could be
> wrong?
>
> Thanks in advance for your help.
> Regards,
> Debbie Leddon


  • Prev by Date: Re: Compile and NormalDistribution
  • Next by Date: Re: Question about how Contex resolving works in Mathematica
  • Previous by thread: Re: FW: Re: Frequencies function
  • Next by thread: Re:FW: Re: Frequencies function