[R] tm package

2011-05-28 Thread lloyd barcza
Hi,

I am using the tm package. When I try to use findfreqterms I get an error 
message:

findfreqterms(dtm,2,5)
Error: could not find function findfreqterms

Obvious thing such as calling the tm library and a creating document term 
matrix have been covered. I cannot find any dependencies that findfreqterms 
has. Can anyone help with this?

Thanks

__
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] optim(,SANN...)

2009-11-22 Thread lloyd barcza
Hi,

Can anyone please tell me is there a way to view the annealing schedule when 
using SANN is optim. I have tried setting report=1 in the control list, but 
cannot seem to get it to work?

Ant help or suggestions would be appreciated!

Thanks

__
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] optim(.. ,SANN,..)

2009-11-19 Thread lloyd barcza
I have a problem using optim, so I am hoping someone can help me out with it:

Suppose I have the list:

list(D,R,P)
[[1]]
   V1 V2 V3 V4
1   0  1  0  1
2   1  1  0  0
3   1  0  1  0
4   0  0  1  1
5   0  1  0  1
6   1  1  0  0
7   1  0  1  0
8   0  0  1  1
9   1  0  1  0
10  0  0  1  1

[[2]]
 [1]   23   85   12   73   23   24   25   56   78 1200

[[3]]
  V1
1 25
2 80
3 15
4 60
5 56
6 15
7 20
8 70
9 45
10 12000

and the strange function fr which I want to maximise:

fr-function(x){y-x*D
C-apply(t(apply(y,1,function(c){c[c0]})),1,prod)
R2-R*C
w-R2[R2P]
g-sum(w)
return(g)}

v-c(1,1,1,1,1,1,1,1,1,1)

res - optim(v, fr, method=SANN,
  control=list(maxit=200, temp=20,v))

I get the following error:
Error in prod(..., na.rm = na.rm) : invalid 'type' (list) of argument

I'm not sure if its because this function is too disjoint to be opimised using 
SANN or I am not using optim properly. 

Any help or suggestions would be appreciated.

Thanks

__
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] reduce matrix

2009-11-18 Thread lloyd barcza
I am trying to reduce the dimension of matrix by removing zero elements and 
creating a sub-matrix.

For example:

A= [1,0,0,3;  0,1,2,0; 0,0,3,5]

then the new matrix B would be:

B= [1,3;1,2;3,5]

There are the same number of zero elements in each row of A so dimension of B 
will not be a problem. Is there a straightforward way to do this in R without 
writing a function using loops etc?

Any help or suggestions would be appreciated!

Thanks

__
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] R-help

2009-11-16 Thread Lloyd Barcza


I have been trying to write a function for the following problem:

Suppose I have three vectors a,b,c of different lengths:
e.g. a=c(a1,a2,a3,...) where a[i] form the basis of our function variables:

if we define a table for example:




and define the fn(x) -function{..sum(argument)..}
where x-c(a,b,c) so that we can maximise fn(x) as:

optim(...,fn,). So in other words the problem
if to find optimal values for vectors a,b,c. I'm
not sure how to set this problem up as a function
in R. Any help would be much appreciated.

Regards

Lloyd Barcza
- Forwarded by Lloyd Barcza/UK/RoyalSun on
16/11/2009 15:07 -






Lloyd Barcza
Pricing Analyst
Affinity Pricing
Royal  SunAlliance
Tel: 01403 234784
Email: lloyd.bar...@uk.rsagroup.com


   
__

   **
   MORE THN ® is a trading style of Royal  Sun Alliance
   Insurance plc (No. 93792). Registered in England and Wales at
   St. Mark's Court, Chart Way, Horsham, West Sussex RH12 1XL.
   Authorised  regulated by the Financial Services Authority

   For your protection, telephone calls will be recorded and may be
   monitored.

   The information in this e-mail is confidential and ma...{{dropped:15}}

__
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] R-help

2009-11-16 Thread Lloyd Barcza


I have been trying to write a function for the following problem:

Suppose I have three vectors a,b,c of different lengths:
e.g. a=c(a1,a2,a3,...) where a[i] form the basis of our function variables:

if we define a table for example:




and define the fn(x) -function{..sum(argument)..}
where x-c(a,b,c) so that we can maximise fn(x) as:

optim(...,fn,). So in other words the problem
if to find optimal values for vectors a,b,c. I'm
not sure how to set this problem up as a function
in R. Any help would be much appreciated.

Regards

Lloyd Barcza
- Forwarded by Lloyd Barcza/UK/RoyalSun on
16/11/2009 15:07 -






Lloyd Barcza
Pricing Analyst
Affinity Pricing
Royal  SunAlliance
Tel: 01403 234784
Email: lloyd.bar...@uk.rsagroup.com


   
__

   **
   MORE THN ® is a trading style of Royal  Sun Alliance
   Insurance plc (No. 93792). Registered in England and Wales at
   St. Mark's Court, Chart Way, Horsham, West Sussex RH12 1XL.
   Authorised  regulated by the Financial Services Authority

   For your protection, telephone calls will be recorded and may be
   monitored.

   The information in this e-mail is confidential and ma...{{dropped:15}}

__
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.