Re: [R] linear programming in R | limits to what it can do, or my mistake?

2024-01-30 Thread Jinsong Zhao



On 2024/1/30 20:00, Martin Becker wrote:
Apart from the fact that the statement "such that t1+t2+t3+t4=2970 (as 
it must)" is not correct, the LP can be implemented as follows:


I was confused by "such that t1+t2+t3+t4=2970 (as it must)", otherwise, 
I also get the same solution.

library(lpSolve)
LHS <- rbind(
c(0,0,0,0, 1, 0, 0,0),
c(1,0,0,0,-1, 1, 0,0),
c(0,1,0,0, 0,-1, 1,0),
c(0,0,1,0, 0, 0,-1,1),
cbind(-diag(4),diag(4)),
c(0,0,0,0,0,1,0,0),
c(0,0,0,0,0,0,1,0),
c(0,0,0,0,0,0,0,1)
)

RHS <- c(640,825,580,925,0,0,0,0,1000,1000,1000)

DIR <- c(rep("==",4),rep(">=",3),"=",rep("<=",3))

OBJ <- c(35,55,50,65,0,0,0,0)

lp("min",OBJ,LHS,DIR,RHS)

Best,
Martin


Am 29.01.24 um 22:28 schrieb Evan Cooch:

Question for 'experts' in LP using R (using the lpSolve package, say) --
which does not apply to me for the sort of problem I describe below.
I've run any number of LP's using lpSolve in R, but all of them to date
have objective and constraint functions that both contain the same
variables. This lets you set up a LHS and RHS matrix/vector that are
symmetrical.

But, for a problem a student posed in class, I'm stuck with how to do it
in R, if its even possible (its trivial in Maxima, Maple...even using
Solver in Excel, but I haven't been remotely successful in getting
anything to work in R).

Suppose you have a production system that at 4 sequential time steps
generate 640, 825, 580, and 925 units. At each time step, you need to
decide how many of those units need to be 'quality control' (QC) checked
in some fashion, subject to some constraints.

   --> at no point in time can the number of units in the system be 
>1000

   --> at the end of the production cycle, there can be no units left
   --> 'QC checking' costs money, varying as a function of the time step
-- 35, 55, 50 and 65 for each unit, for each time step in turn.

Objective is to minimize total cost. The total cost objective function
is trivial. Let p1 = number sent out time step 1, p2 number sent out at
time step 3, and so on. So, total cost function we want to minimize is
simply

    cost=(35*p1)+(55*p2)+(50*p3)+(65*p4)

where p1+p2+p3+p4=(640+825+580+925)=2970 (i.e., all the products get
checked). The question is, what number do you send out at each time step
to minimize cost?

Where I get hung up in R is the fact that if I let t(i) be the number of
products at each time step, then

      t1=640,
      t2=t1-p1+825
      t3=t2-p2+580
      t4=t3-p3+925

such that t1+t2+t3+t4=2970 (as it must), with additional constraints 
being


    p1<=t1, p2<=t2, p3<=t3, p4<=t4, {t1..t4}<=1000, and t4-p4=0.

There may be algebraic ways to reduce the number of functions needed to
describe the constraints, but I can't for the life of me see how I can
create a coefficient matrix (typically, the LHS) since each line of said
matrix, which corresponds to the constraints, needs to be a function of
the unknowns in the objective function -- being, p1, p2, p3 and p4.

In Maple (for example), this is trivial:

   cost:=35*p10+55*p12+50*p14+65*p16;
cnsts:={t10=640,t12=t10-p10+825,t14=t12-p12+580,t16=t14-p14+925,t16-p16=0,p10<=t10,p12<=t12,p14<=t14,p16<=t16,t10<=1000,t12<=1000,t14<=1000,t16<=1000}; 


       Minimize(cost,cnsts,assume={nonnegative});

which yields (correctly):

p1=640, p2=405, p3=1000, p4=925

for minimized cost of 154800.

Took only a minute to also set this up in Maxima, and using Solver in
Excel. But danged if I can suss out any way to do this in R.

Pointers to the obvious welcome.
[[alternative HTML version deleted]]






__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] linear programming in R | limits to what it can do, or my mistake?

2024-01-30 Thread Martin Becker
Apart from the fact that the statement "such that t1+t2+t3+t4=2970 (as 
it must)" is not correct, the LP can be implemented as follows:


library(lpSolve)
LHS <- rbind(
c(0,0,0,0, 1, 0, 0,0),
c(1,0,0,0,-1, 1, 0,0),
c(0,1,0,0, 0,-1, 1,0),
c(0,0,1,0, 0, 0,-1,1),
cbind(-diag(4),diag(4)),
c(0,0,0,0,0,1,0,0),
c(0,0,0,0,0,0,1,0),
c(0,0,0,0,0,0,0,1)
)

RHS <- c(640,825,580,925,0,0,0,0,1000,1000,1000)

DIR <- c(rep("==",4),rep(">=",3),"=",rep("<=",3))

OBJ <- c(35,55,50,65,0,0,0,0)

lp("min",OBJ,LHS,DIR,RHS)

Best,
Martin


Am 29.01.24 um 22:28 schrieb Evan Cooch:

Question for 'experts' in LP using R (using the lpSolve package, say) --
which does not apply to me for the sort of problem I describe below.
I've run any number of LP's using lpSolve in R, but all of them to date
have objective and constraint functions that both contain the same
variables. This lets you set up a LHS and RHS matrix/vector that are
symmetrical.

But, for a problem a student posed in class, I'm stuck with how to do it
in R, if its even possible (its trivial in Maxima, Maple...even using
Solver in Excel, but I haven't been remotely successful in getting
anything to work in R).

Suppose you have a production system that at 4 sequential time steps
generate 640, 825, 580, and 925 units. At each time step, you need to
decide how many of those units need to be 'quality control' (QC) checked
in some fashion, subject to some constraints.

   --> at no point in time can the number of units in the system be >1000
   --> at the end of the production cycle, there can be no units left
   --> 'QC checking' costs money, varying as a function of the time step
-- 35, 55, 50 and 65 for each unit, for each time step in turn.

Objective is to minimize total cost. The total cost objective function
is trivial. Let p1 = number sent out time step 1, p2 number sent out at
time step 3, and so on. So, total cost function we want to minimize is
simply

    cost=(35*p1)+(55*p2)+(50*p3)+(65*p4)

where p1+p2+p3+p4=(640+825+580+925)=2970 (i.e., all the products get
checked). The question is, what number do you send out at each time step
to minimize cost?

Where I get hung up in R is the fact that if I let t(i) be the number of
products at each time step, then

      t1=640,
      t2=t1-p1+825
      t3=t2-p2+580
      t4=t3-p3+925

such that t1+t2+t3+t4=2970 (as it must), with additional constraints being

    p1<=t1, p2<=t2, p3<=t3, p4<=t4, {t1..t4}<=1000, and t4-p4=0.

There may be algebraic ways to reduce the number of functions needed to
describe the constraints, but I can't for the life of me see how I can
create a coefficient matrix (typically, the LHS) since each line of said
matrix, which corresponds to the constraints, needs to be a function of
the unknowns in the objective function -- being, p1, p2, p3 and p4.

In Maple (for example), this is trivial:

   cost:=35*p10+55*p12+50*p14+65*p16;
cnsts:={t10=640,t12=t10-p10+825,t14=t12-p12+580,t16=t14-p14+925,t16-p16=0,p10<=t10,p12<=t12,p14<=t14,p16<=t16,t10<=1000,t12<=1000,t14<=1000,t16<=1000};
       Minimize(cost,cnsts,assume={nonnegative});

which yields (correctly):

p1=640, p2=405, p3=1000, p4=925

for minimized cost of 154800.

Took only a minute to also set this up in Maxima, and using Solver in
Excel. But danged if I can suss out any way to do this in R.

Pointers to the obvious welcome.
[[alternative HTML version deleted]]




--
apl. Prof. PD Dr. Martin Becker, Akad. Oberrat
Lehrstab Statistik
Quantitative Methoden
Fakultät für Empirische Humanwissenschaften und Wirtschaftswissenschaft
Universität des Saarlandes
Campus C3 1, Raum 2.17
66123 Saarbrücken
Deutschland

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] linear programming in R | limits to what it can do, or my mistake?

2024-01-30 Thread Evan Cooch
Question for 'experts' in LP using R (using the lpSolve package, say) -- 
which does not apply to me for the sort of problem I describe below.
I've run any number of LP's using lpSolve in R, but all of them to date 
have objective and constraint functions that both contain the same 
variables. This lets you set up a LHS and RHS matrix/vector that are 
symmetrical.

But, for a problem a student posed in class, I'm stuck with how to do it 
in R, if its even possible (its trivial in Maxima, Maple...even using 
Solver in Excel, but I haven't been remotely successful in getting 
anything to work in R).

Suppose you have a production system that at 4 sequential time steps 
generate 640, 825, 580, and 925 units. At each time step, you need to 
decide how many of those units need to be 'quality control' (QC) checked 
in some fashion, subject to some constraints.

  --> at no point in time can the number of units in the system be >1000
  --> at the end of the production cycle, there can be no units left
  --> 'QC checking' costs money, varying as a function of the time step 
-- 35, 55, 50 and 65 for each unit, for each time step in turn.

Objective is to minimize total cost. The total cost objective function 
is trivial. Let p1 = number sent out time step 1, p2 number sent out at 
time step 3, and so on. So, total cost function we want to minimize is 
simply

   cost=(35*p1)+(55*p2)+(50*p3)+(65*p4)

where p1+p2+p3+p4=(640+825+580+925)=2970 (i.e., all the products get 
checked). The question is, what number do you send out at each time step 
to minimize cost?

Where I get hung up in R is the fact that if I let t(i) be the number of 
products at each time step, then

     t1=640,
     t2=t1-p1+825
     t3=t2-p2+580
     t4=t3-p3+925

such that t1+t2+t3+t4=2970 (as it must), with additional constraints being

   p1<=t1, p2<=t2, p3<=t3, p4<=t4, {t1..t4}<=1000, and t4-p4=0.

There may be algebraic ways to reduce the number of functions needed to 
describe the constraints, but I can't for the life of me see how I can 
create a coefficient matrix (typically, the LHS) since each line of said 
matrix, which corresponds to the constraints, needs to be a function of 
the unknowns in the objective function -- being, p1, p2, p3 and p4.

In Maple (for example), this is trivial:

  cost:=35*p10+55*p12+50*p14+65*p16;
cnsts:={t10=640,t12=t10-p10+825,t14=t12-p12+580,t16=t14-p14+925,t16-p16=0,p10<=t10,p12<=t12,p14<=t14,p16<=t16,t10<=1000,t12<=1000,t14<=1000,t16<=1000};
      Minimize(cost,cnsts,assume={nonnegative});

which yields (correctly):

p1=640, p2=405, p3=1000, p4=925

for minimized cost of 154800.

Took only a minute to also set this up in Maxima, and using Solver in 
Excel. But danged if I can suss out any way to do this in R.

Pointers to the obvious welcome.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Limits of detection with package pls

2016-03-23 Thread Castro, Alonso
I'm using package pls to perform partial least squares regression. Data is four 
spectra (13178 intensity measurements each) that correspond to 4 concentrations.

out <- plsr(concentration ~ intensity, ncomp=2, data=libs, validation = "LOO")

Does the package have a command to calculate limits of detection? I have seen 
conflicting descriptions on how to do this in the literature.

Thanks, Alonso.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] limits on liniar model

2011-08-03 Thread John Sorkin
It is hard to prove a negative, but to the best of my knowledge lm will not do 
what you want. This does not mean there is not a function that will perform 
your analyses; the sort of thing you want to do is often accomplished using 
non-linear methods.
John 

>>> ראובן אברמוביץ 8/3/2011 12:00:04 PM >>>

   Can I put limits on the lm() command? I only know that you can choose a
   liniar model with or without an intercept, but can I put other limits on
   the coefficients (for example- the intercept must be bigger than 1) ?

 _

   Walla! Mail - [1]Get your free unlimited mail today

References

   1. http://www.walla.co.il/

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

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


Re: [R] limits on liniar model

2011-08-03 Thread Bert Gunter
Please use R's search capabilities before posting.

RSiteSearch("Linear Model with Constraints")

appears to give you what you're looking for. Incidentally, with
constraints, the model is no longer linear, I believe.

-- Bert

2011/8/3 ראובן אברמוביץ :
>
>   Can I put limits on the lm() command? I only know that you can choose a
>   liniar model with or without an intercept, but can I put other limits on
>   the coefficients (for example- the intercept must be bigger than 1) ?
>
>     _
>
>   Walla! Mail - [1]Get your free unlimited mail today
>
> References
>
>   1. http://www.walla.co.il/
>
> __
> 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.
>
>



-- 
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics

__
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] limits on liniar model

2011-08-03 Thread ראובן אברמוביץ

   Can I put limits on the lm() command? I only know that you can choose a
   liniar model with or without an intercept, but can I put other limits on
   the coefficients (for example- the intercept must be bigger than 1) ?

 _

   Walla! Mail - [1]Get your free unlimited mail today

References

   1. http://www.walla.co.il/
__
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.


Re: [R] limits of a data frame size for reading into R

2010-08-05 Thread Matthew Keller
I sometimes have to work with vectors/matrices with > 2^31 - 1
elements. I have found the bigmemory package to be of great help. My
lab is also going to learn sqldf package for getting bits of big data
into/out of R. Learning both of those packages should help you work
with large datasets in R.

That said, I still hold out hope that someday, the powers that be - or
some hotshot operation like R+ or Revolutions - will see that
increasing numbers of users will routinely need to access > 2^31-1
elements, and that the packages above are a band-aid on a deeper
issue: using such large datasets with ease in R. As of now, it remains
quite awkward.

Matt



On Tue, Aug 3, 2010 at 12:32 PM, Duncan Murdoch
 wrote:
> On 03/08/2010 2:28 PM, Dimitri Liakhovitski wrote:
>>
>> And once one above the limit that Jim indicated - is there anything one
>> can do?
>>
>
> Yes, there are several packages for handling datasets that are too big to
> fit in memory:  biglm, ff, etc.  You need to change your code to work with
> them, so it's a lot of work to do something unusual, but there are
> possibilities.
>
> Duncan Murdoch
>
>> Thank you!
>> Dimitri
>>
>>
>> On Tue, Aug 3, 2010 at 2:12 PM, Dimitri Liakhovitski
>>  wrote:
>> > Thanks a lot, it's very helpful!
>> > Dimitri
>> >
>> > On Tue, Aug 3, 2010 at 1:53 PM, Duncan Murdoch
>> >  wrote:
>> >> On 03/08/2010 1:10 PM, Dimitri Liakhovitski wrote:
>> >>>
>> >>> I understand the question I am about to ask is rather vague and
>> >>> depends on the task and my PC memory. However, I'll give it a try:
>> >>>
>> >>> Let's assume the goal is just to read in the data frame into R and
>> >>> then do some simple analyses with it (e.g., multiple regression of
>> >>> some variables onto some - just a few - variables).
>> >>>
>> >>> Is there a limit to the number of columns of a data frame that R can
>> >>> handle? I am asking because where I work many use SAS and they are
>> >>> running into the limit of >~13,700columns there.
>> >>>
>> >>> Since I am asking - is there a limit to the number of rows?
>> >>>
>> >>> Or is the correct way of asking the question: my PC's memory is X. The
>> >>> .txt tab-delimited file I am trying to read in has the size of YYY Mb,
>> >>> can I read it in?
>> >>>
>> >>
>> >> Besides what Jim said, there is a 2^31-1 limit on the number of
>> >> elements in
>> >> a vector.  Dataframes are vectors of vectors, so you can have at most
>> >> 2^31-1
>> >> rows and 2^31-1 columns.  Matrices are vectors, so they're limited to
>> >> 2^31-1
>> >> elements in total.
>> >> This is only likely to be a limitation on a 64 bit machine; in 32 bits
>> >> you'll run out of memory first.
>> >>
>> >> Duncan Murdoch
>> >>
>> >
>> >
>> >
>> > --
>> > Dimitri Liakhovitski
>> > Ninah Consulting
>> > www.ninah.com
>> >
>>
>>
>>
>>
>
> __
> 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.
>



-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com

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


Re: [R] limits of a data frame size for reading into R

2010-08-03 Thread Duncan Murdoch

On 03/08/2010 2:28 PM, Dimitri Liakhovitski wrote:

And once one above the limit that Jim indicated - is there anything one can do?
  


Yes, there are several packages for handling datasets that are too big 
to fit in memory:  biglm, ff, etc.  You need to change your code to work 
with them, so it's a lot of work to do something unusual, but there are 
possibilities.


Duncan Murdoch


Thank you!
Dimitri


On Tue, Aug 3, 2010 at 2:12 PM, Dimitri Liakhovitski
 wrote:
> Thanks a lot, it's very helpful!
> Dimitri
>
> On Tue, Aug 3, 2010 at 1:53 PM, Duncan Murdoch  
wrote:
>> On 03/08/2010 1:10 PM, Dimitri Liakhovitski wrote:
>>>
>>> I understand the question I am about to ask is rather vague and
>>> depends on the task and my PC memory. However, I'll give it a try:
>>>
>>> Let's assume the goal is just to read in the data frame into R and
>>> then do some simple analyses with it (e.g., multiple regression of
>>> some variables onto some - just a few - variables).
>>>
>>> Is there a limit to the number of columns of a data frame that R can
>>> handle? I am asking because where I work many use SAS and they are
>>> running into the limit of >~13,700columns there.
>>>
>>> Since I am asking - is there a limit to the number of rows?
>>>
>>> Or is the correct way of asking the question: my PC's memory is X. The
>>> .txt tab-delimited file I am trying to read in has the size of YYY Mb,
>>> can I read it in?
>>>
>>
>> Besides what Jim said, there is a 2^31-1 limit on the number of elements in
>> a vector.  Dataframes are vectors of vectors, so you can have at most 2^31-1
>> rows and 2^31-1 columns.  Matrices are vectors, so they're limited to 2^31-1
>> elements in total.
>> This is only likely to be a limitation on a 64 bit machine; in 32 bits
>> you'll run out of memory first.
>>
>> Duncan Murdoch
>>
>
>
>
> --
> Dimitri Liakhovitski
> Ninah Consulting
> www.ninah.com
>






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


Re: [R] limits of a data frame size for reading into R

2010-08-03 Thread Dimitri Liakhovitski
And once one above the limit that Jim indicated - is there anything one can do?
Thank you!
Dimitri


On Tue, Aug 3, 2010 at 2:12 PM, Dimitri Liakhovitski
 wrote:
> Thanks a lot, it's very helpful!
> Dimitri
>
> On Tue, Aug 3, 2010 at 1:53 PM, Duncan Murdoch  
> wrote:
>> On 03/08/2010 1:10 PM, Dimitri Liakhovitski wrote:
>>>
>>> I understand the question I am about to ask is rather vague and
>>> depends on the task and my PC memory. However, I'll give it a try:
>>>
>>> Let's assume the goal is just to read in the data frame into R and
>>> then do some simple analyses with it (e.g., multiple regression of
>>> some variables onto some - just a few - variables).
>>>
>>> Is there a limit to the number of columns of a data frame that R can
>>> handle? I am asking because where I work many use SAS and they are
>>> running into the limit of >~13,700columns there.
>>>
>>> Since I am asking - is there a limit to the number of rows?
>>>
>>> Or is the correct way of asking the question: my PC's memory is X. The
>>> .txt tab-delimited file I am trying to read in has the size of YYY Mb,
>>> can I read it in?
>>>
>>
>> Besides what Jim said, there is a 2^31-1 limit on the number of elements in
>> a vector.  Dataframes are vectors of vectors, so you can have at most 2^31-1
>> rows and 2^31-1 columns.  Matrices are vectors, so they're limited to 2^31-1
>> elements in total.
>> This is only likely to be a limitation on a 64 bit machine; in 32 bits
>> you'll run out of memory first.
>>
>> Duncan Murdoch
>>
>
>
>
> --
> Dimitri Liakhovitski
> Ninah Consulting
> www.ninah.com
>



-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com

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


Re: [R] limits of a data frame size for reading into R

2010-08-03 Thread Dimitri Liakhovitski
Thanks a lot, it's very helpful!
Dimitri

On Tue, Aug 3, 2010 at 1:53 PM, Duncan Murdoch  wrote:
> On 03/08/2010 1:10 PM, Dimitri Liakhovitski wrote:
>>
>> I understand the question I am about to ask is rather vague and
>> depends on the task and my PC memory. However, I'll give it a try:
>>
>> Let's assume the goal is just to read in the data frame into R and
>> then do some simple analyses with it (e.g., multiple regression of
>> some variables onto some - just a few - variables).
>>
>> Is there a limit to the number of columns of a data frame that R can
>> handle? I am asking because where I work many use SAS and they are
>> running into the limit of >~13,700columns there.
>>
>> Since I am asking - is there a limit to the number of rows?
>>
>> Or is the correct way of asking the question: my PC's memory is X. The
>> .txt tab-delimited file I am trying to read in has the size of YYY Mb,
>> can I read it in?
>>
>
> Besides what Jim said, there is a 2^31-1 limit on the number of elements in
> a vector.  Dataframes are vectors of vectors, so you can have at most 2^31-1
> rows and 2^31-1 columns.  Matrices are vectors, so they're limited to 2^31-1
> elements in total.
> This is only likely to be a limitation on a 64 bit machine; in 32 bits
> you'll run out of memory first.
>
> Duncan Murdoch
>



-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com

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


Re: [R] limits of a data frame size for reading into R

2010-08-03 Thread Duncan Murdoch

On 03/08/2010 1:10 PM, Dimitri Liakhovitski wrote:

I understand the question I am about to ask is rather vague and
depends on the task and my PC memory. However, I'll give it a try:

Let's assume the goal is just to read in the data frame into R and
then do some simple analyses with it (e.g., multiple regression of
some variables onto some - just a few - variables).

Is there a limit to the number of columns of a data frame that R can
handle? I am asking because where I work many use SAS and they are
running into the limit of >~13,700columns there.

Since I am asking - is there a limit to the number of rows?

Or is the correct way of asking the question: my PC's memory is X. The
.txt tab-delimited file I am trying to read in has the size of YYY Mb,
can I read it in?
  


Besides what Jim said, there is a 2^31-1 limit on the number of elements 
in a vector.  Dataframes are vectors of vectors, so you can have at most 
2^31-1 rows and 2^31-1 columns.  Matrices are vectors, so they're 
limited to 2^31-1 elements in total. 

This is only likely to be a limitation on a 64 bit machine; in 32 bits 
you'll run out of memory first.


Duncan Murdoch

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


Re: [R] limits of a data frame size for reading into R

2010-08-03 Thread jim holtman
You probably don't want an object that is larger than about 25% of the
physical memory so that copies can be made during some processing.  If
you are running on a 32-bit system which will limit you to at most 3GB
of memory, then your largest object should not be greater than 800MB.
If you want to have 13,700 columns of numeric data (takes 8 bytes per
element), then each row would require about 100KB and that would mean
you would probably have an object with about 8000 rows.

64-bit is probably limited by how much you want to spend for memory.

On Tue, Aug 3, 2010 at 1:10 PM, Dimitri Liakhovitski
 wrote:
> I understand the question I am about to ask is rather vague and
> depends on the task and my PC memory. However, I'll give it a try:
>
> Let's assume the goal is just to read in the data frame into R and
> then do some simple analyses with it (e.g., multiple regression of
> some variables onto some - just a few - variables).
>
> Is there a limit to the number of columns of a data frame that R can
> handle? I am asking because where I work many use SAS and they are
> running into the limit of >~13,700columns there.
>
> Since I am asking - is there a limit to the number of rows?
>
> Or is the correct way of asking the question: my PC's memory is X. The
> .txt tab-delimited file I am trying to read in has the size of YYY Mb,
> can I read it in?
>
> Thanks a lot!
>
> --
> Dimitri Liakhovitski
> Ninah Consulting
> www.ninah.com
>
> __
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] limits of a data frame size for reading into R

2010-08-03 Thread Dimitri Liakhovitski
I understand the question I am about to ask is rather vague and
depends on the task and my PC memory. However, I'll give it a try:

Let's assume the goal is just to read in the data frame into R and
then do some simple analyses with it (e.g., multiple regression of
some variables onto some - just a few - variables).

Is there a limit to the number of columns of a data frame that R can
handle? I am asking because where I work many use SAS and they are
running into the limit of >~13,700columns there.

Since I am asking - is there a limit to the number of rows?

Or is the correct way of asking the question: my PC's memory is X. The
.txt tab-delimited file I am trying to read in has the size of YYY Mb,
can I read it in?

Thanks a lot!

-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com

__
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] spatstat: changing r limits when plot envelope

2009-06-08 Thread milton ruser
Dear all,

I need to change the default of "r" when plotting the
output of the envelope function of spatstat package.

I can do this manually for the Lest output:

## Example from spatstat Kest help
 data(cells)
 L <- Lest(cells, correction="isotropic", r=seq(from=0,to=0.5, by=0.05))
 x11(1000,400)
 par(mfrow=c(1,3))
 plot(L)
 plot(L$iso~L$r, type="l")
###

but when I try change the xlim for plot(envelope(...)) only
the xlim are changed, but the output of envelope remains
the default one.

 plot(envelope(cells,Lest,r=seq(from=0,to=0.5,
by=0.05),nsim=19,correction="isotropic",nrank=1,global=TRUE),.- r
~r,ylab="L(r)-r", xlim=c(0,0.5))
Any help are welcome.

Cheers

milton
brazil=toronto

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


Re: [R] limits

2009-05-13 Thread Gabor Grothendieck
Try the rSymPy or Ryacas packages.

In the rSymPy code below the var command defines x
as symbolic to sympy and then we perform the
computation:

> library(rSymPy)
Loading required package: rJava
> sympy("var('x')")
[1] "x"
> sympy("limit(x*x + x + 2, x, 2)")
[1] "8"

Or using devel version define x as symbolic first to sympy
and then to R:

> library(rSymPy)
> source("http://rsympy.googlecode.com/svn/trunk/R/Sym.R";)
> sympy("var('x')")
[1] "x"
> x <- Sym("x")
> limit(x*x + x + 2, x, 2)
[1] "8"

or using Ryacas:

> library(Ryacas)
Loading required package: XML
> x <- Sym("x")
> Limit(x^2+x+2, x, 2)
[1] "Starting Yacas!"
expression(8)

More info is available here which you should read before
using these packages:

http://rsympy.googlecode.com
http://ryacas.googlecode.com


On Tue, May 5, 2009 at 5:39 AM, Hassan Mohamed
 wrote:
> Hey,
> what is the R function for the mathematical limit ?
> e.g. to calculate  and return the amount that the expression
> X^2 +X +2
> approach
> as X approach 2
> (X-> 2)
> thanks
> hassan
>
>
>
>        [[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.


Re: [R] limits

2009-05-13 Thread Mike Prager
Uwe Ligges  wrote:

> So you want some software that can do symbolic calculations? In that 
> case use other software. R is designed for numerical analyses.

In particular, if you are looking for good free software, you
might try Maxima.


-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

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


Re: [R] limits

2009-05-05 Thread Uwe Ligges



Hassan Mohamed wrote:

Hey,
what is the R function for the mathematical limit ?
e.g. to calculate  and return the amount that the expression
X^2 +X +2 
approach

as X approach 2
(X-> 2)



So you want some software that can do symbolic calculations? In that 
case use other software. R is designed for numerical analyses.


Uwe Ligges



thanks
hassan


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


Re: [R] limits

2009-05-05 Thread Jorge Ivan Velez
Dear Hassam,
Take a look at the section 5.8 in [1].

HTH,

Jorge

[1] http://cran.r-project.org/web/packages/Ryacas/vignettes/Ryacas.pdf


On Tue, May 5, 2009 at 5:39 AM, Hassan Mohamed
wrote:

> Hey,
> what is the R function for the mathematical limit ?
> e.g. to calculate  and return the amount that the expression
> X^2 +X +2
> approach
> as X approach 2
> (X-> 2)
> thanks
> hassan
>
>
>
>[[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.
>

[[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] limits

2009-05-05 Thread Hassan Mohamed
Hey,
what is the R function for the mathematical limit ?
e.g. to calculate  and return the amount that the expression
X^2 +X +2 
approach
as X approach 2
(X-> 2)
thanks
hassan


  
[[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] limits/thresholds for arrayWeights in the limma package

2008-08-07 Thread Radek Blatny
Is there any limit ratio of between-array weight values, which one  
can get using the arrayWeights() function in the limma package  
? For  
instance, if one array has the weight value - let's say - 4 and the  
rest between 0.5 and 2, shall I keep the array and use it with the  
weight array, or rather discard the one array and apply again the  
arrayWeights() again and continue to results? I am particularly  
interested in answers related to the mouse 430_2 chips.


Regards, Radek

Radek Blatny, MSc.
Institute of Molecular Genetics
Department of Mouse Molecular Genetics (Jiri Forejt unit)
Czech Academy of Sciences
Videnska 1083
142 20, Prague
Czech Republic
Tel. (+420) 241 062 260
Fax (+420) 241 062 154
http://www.img.cas.cz/mmg
email: [EMAIL PROTECTED]
Skype name: blatny

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


Re: [R] limits on the length of the name of a script file in R 2.6.0.?

2007-11-26 Thread Duncan Murdoch
On 11/26/2007 11:03 AM, Dimitri Liakhovitski wrote:
> Hello!
> I posted earlier - about my problems with R 2.6 crashing (i.e.,
> telling me it needs to shut down) every time I tried to open an R
> script. First, it looked like it was unhappy with my working outside
> of R folder (under Program Files). But not it looks like it was not
> really the problem.
> Now, it opens and works when I open scripts whose names are not very
> long (e.g., "Selecting cases I need.R"). But it does crash (gives me a
> message that R needs to shut down) when the script I am trying to open
> has a slightly longer file name (e.g, in my case:
> "randforestImportanceExample with MR.r" and longer).
> 
> Is anyone aware of the limits the latest version of R imposes on
> script name length? I never experienced such a problem with R 2.5.0.

The latest version of R is 2.6.1 (released today), but I doubt if you're 
using that yet.  It has the same limit as Windows on filename length.

2.6.0 had a bug which meant long filenames could cause a crash.  This 
was repaired a couple of weeks ago:

http://developer.r-project.org/blosxom.cgi/R-2-6-branch/2007/11/10#c2007-11-10

Duncan Murdoch

__
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] limits on the length of the name of a script file in R 2.6.0.?

2007-11-26 Thread Dimitri Liakhovitski
Hello!
I posted earlier - about my problems with R 2.6 crashing (i.e.,
telling me it needs to shut down) every time I tried to open an R
script. First, it looked like it was unhappy with my working outside
of R folder (under Program Files). But not it looks like it was not
really the problem.
Now, it opens and works when I open scripts whose names are not very
long (e.g., "Selecting cases I need.R"). But it does crash (gives me a
message that R needs to shut down) when the script I am trying to open
has a slightly longer file name (e.g, in my case:
"randforestImportanceExample with MR.r" and longer).

Is anyone aware of the limits the latest version of R imposes on
script name length? I never experienced such a problem with R 2.5.0.

Thank you!
Dimitri Liakhovitski

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