Hi, Below is the code I write, I am trying to create a metric of h and t while the values is out of function R. First I have message warning Second, the metric is not created> h <- seq(0.1, 0.9, by=0.1) > t <- seq(0,11000, by=100) > z <- cbind(t) > eta=10000 > beta=2 > R <- array (1:1100, dim= c(110,10)) > R= exp(-(z/eta*(1-h))^(beta*(1-h)))Warning messages: 1: In z/eta * (1 - h) : longer object length is not a multiple of shorter object length 2: In (z/eta * (1 - h))^(beta * (1 - h)) : longer object length is not a multiple of shorter object length> Rt [1,] 1.0000000 [2,] 0.9995586 [3,] 0.9974647 [4,] 0.9919725 [5,] 0.9801987 [6,] 0.9572081 [7,] 0.9141353 [8,] 0.8341665 [9,] 0.6833618 [10,] 0.9892125 [11,] 0.9825766 [12,] 0.9727664 [13,] 0.9583520 [14,] 0.9370675 [15,] 0.9051390 [16,] 0.8559267 [17,] 0.7769472 [18,] 0.6423128 [19,] 0.9629361 [20,] 0.9521001 [21,] 0.9382259 [22,] 0.9201104 [23,] 0.8958341 [24,] 0.8622051 [25,] 0.8136275 [26,] 0.7395534 [27,] 0.6175830 [28,] 0.9246320 [29,] 0.9127580 [30,] 0.8982795 [31,] 0.8800821 [32,] 0.8564152 [33,] 0.8244048 [34,] 0.7790512 [35,] 0.7109198 [36,] 0.5996181 [37,] 0.8767646 [38,] 0.8671159 [39,] 0.8550329 [40,] 0.8394499 [41,] 0.8187308 [42,] 0.7902253 [43,] 0.7493487 [44,] 0.6874269 [45,] 0.5854263 [46,] 0.8215803 [47,] 0.8170930 [48,] 0.8098560 [49,] 0.7988930 [50,] 0.7827045 [51,] 0.7588540 [52,] 0.7231046 [53,] 0.6673758 [54,] 0.5736597 [55,] 0.7611968 [56,] 0.7642511 [57,] 0.7637415 [58,] 0.7588504 [59,] 0.7482636 [60,] 0.7297788 [61,] 0.6994875 [62,] 0.6498159 [63,] 0.5635906 [64,] 0.6975913 [65,] 0.7098972 [66,] 0.7174446 [67,] 0.7196221 [68,] 0.7153381 [69,] 0.7026455 [70,] 0.6779572 [71,] 0.6341555 [72,] 0.5547793 [73,] 0.6325678 [74,] 0.6551296 [75,] 0.6715521 [76,] 0.6814181 [77,] 0.6838614 [78,] 0.6771931 [79,] 0.6581383 [80,] 0.6199984 [81,] 0.5469392 [82,] 0.5677232 [83,] 0.6008650 [84,] 0.6265229 [85,] 0.6443861 [86,] 0.6537698 [87,] 0.6532207 [88,] 0.6397566 [89,] 0.6070646 [90,] 0.5398727 [91,] 0.5044222 [92,] 0.5478565 [93,] 0.5827146 [94,] 0.6086282 [95,] 0.6250023 [96,] 0.6305684 [97,] 0.6226043 [98,] 0.5951486 [99,] 0.5334377 [100,] 0.4437834 [101,] 0.4967086 [102,] 0.5404019 [103,] 0.5742126 [104,] 0.5975006 [105,] 0.6091056 [106,] 0.6065193 [107,] 0.5840942 [108,] 0.5275280 [109,] 0.3866770 [110,] 0.4478912 [111,] 0.4997913> length(R)[1] 111 Anan Halabi Reliability Eng, R&D HP Scitex Tel: 972-9-8924648 mobil: 972-52-6624231 [[alternative HTML version deleted]]
Your code works fine -- the warning message is just a heads up that the object z/eta (which has length 111) does not quite match up with 1-h which has length 10: usually this is a sign that the user defined something improperly so R gives you a nice warning, but it doesn't halt the calculation. As to what you mean about your metric not being created -- if it's "R" (odd choice for a variable name given your platform) it sure seems to exist....especially since you just gave us 111 values for it. Though I think you don't know what you mean by "[the] function R". Perhaps you should read about how user defined functions are set up in R (the fantastically useful insightful warning message giving language): http://www.statmethods.net/management/userfunctions.html Michael Weylandt On Fri, Sep 9, 2011 at 2:14 PM, Halabi, Anan <anan.halabi@hp.com> wrote:> > Hi, > Below is the code I write, > I am trying to create a metric of h and t while the values is out of > function R. > First I have message warning > Second, the metric is not created > > > > h <- seq(0.1, 0.9, by=0.1) > > t <- seq(0,11000, by=100) > > z <- cbind(t) > > eta=10000 > > beta=2 > > R <- array (1:1100, dim= c(110,10)) > > R= exp(-(z/eta*(1-h))^(beta*(1-h))) > Warning messages: > 1: In z/eta * (1 - h) : > longer object length is not a multiple of shorter object length > 2: In (z/eta * (1 - h))^(beta * (1 - h)) : > longer object length is not a multiple of shorter object length > > R > t > [1,] 1.0000000 > [2,] 0.9995586 > [3,] 0.9974647 > [4,] 0.9919725 > [5,] 0.9801987 > [6,] 0.9572081 > [7,] 0.9141353 > [8,] 0.8341665 > [9,] 0.6833618 > [10,] 0.9892125 > [11,] 0.9825766 > [12,] 0.9727664 > [13,] 0.9583520 > [14,] 0.9370675 > [15,] 0.9051390 > [16,] 0.8559267 > [17,] 0.7769472 > [18,] 0.6423128 > [19,] 0.9629361 > [20,] 0.9521001 > [21,] 0.9382259 > [22,] 0.9201104 > [23,] 0.8958341 > [24,] 0.8622051 > [25,] 0.8136275 > [26,] 0.7395534 > [27,] 0.6175830 > [28,] 0.9246320 > [29,] 0.9127580 > [30,] 0.8982795 > [31,] 0.8800821 > [32,] 0.8564152 > [33,] 0.8244048 > [34,] 0.7790512 > [35,] 0.7109198 > [36,] 0.5996181 > [37,] 0.8767646 > [38,] 0.8671159 > [39,] 0.8550329 > [40,] 0.8394499 > [41,] 0.8187308 > [42,] 0.7902253 > [43,] 0.7493487 > [44,] 0.6874269 > [45,] 0.5854263 > [46,] 0.8215803 > [47,] 0.8170930 > [48,] 0.8098560 > [49,] 0.7988930 > [50,] 0.7827045 > [51,] 0.7588540 > [52,] 0.7231046 > [53,] 0.6673758 > [54,] 0.5736597 > [55,] 0.7611968 > [56,] 0.7642511 > [57,] 0.7637415 > [58,] 0.7588504 > [59,] 0.7482636 > [60,] 0.7297788 > [61,] 0.6994875 > [62,] 0.6498159 > [63,] 0.5635906 > [64,] 0.6975913 > [65,] 0.7098972 > [66,] 0.7174446 > [67,] 0.7196221 > [68,] 0.7153381 > [69,] 0.7026455 > [70,] 0.6779572 > [71,] 0.6341555 > [72,] 0.5547793 > [73,] 0.6325678 > [74,] 0.6551296 > [75,] 0.6715521 > [76,] 0.6814181 > [77,] 0.6838614 > [78,] 0.6771931 > [79,] 0.6581383 > [80,] 0.6199984 > [81,] 0.5469392 > [82,] 0.5677232 > [83,] 0.6008650 > [84,] 0.6265229 > [85,] 0.6443861 > [86,] 0.6537698 > [87,] 0.6532207 > [88,] 0.6397566 > [89,] 0.6070646 > [90,] 0.5398727 > [91,] 0.5044222 > [92,] 0.5478565 > [93,] 0.5827146 > [94,] 0.6086282 > [95,] 0.6250023 > [96,] 0.6305684 > [97,] 0.6226043 > [98,] 0.5951486 > [99,] 0.5334377 > [100,] 0.4437834 > [101,] 0.4967086 > [102,] 0.5404019 > [103,] 0.5742126 > [104,] 0.5975006 > [105,] 0.6091056 > [106,] 0.6065193 > [107,] 0.5840942 > [108,] 0.5275280 > [109,] 0.3866770 > [110,] 0.4478912 > [111,] 0.4997913 > > length(R) > [1] 111 > > Anan Halabi > Reliability Eng, R&D > HP Scitex > Tel: 972-9-8924648 > mobil: 972-52-6624231 > > > [[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]]
Well, I would point out to you that you only have 9 values of h which certainly is a problem in calculating 10 colmans(?) -- more generally, I'd suggest you learn more about the difference between vectorized operations and operations on vectors: things like `%*%` and outer() will help you greatly. If you are perhaps coming from a Matlab background, keep in mind that R's default behavior is to include the "." before all operations. E.g., R> x = 1:3 R> x^2 [1] 1 4 9 R> x * x [1] 1 4 9 R> x %*% x [,1] [1,] 14 R> outer(x,x) [,1] [,2] [,3] [1,] 1 2 3 [2,] 2 4 6 [3,] 3 6 9 Michael On Fri, Sep 9, 2011 at 2:32 PM, Halabi, Anan <anan.halabi@hp.com> wrote:> What I mean by the metric not created,**** > > Desired metric is of 1100 values by 110 rows (t), and 10 Colman (h)**** > > Thank, **** > > ** ** > > *From:* R. Michael Weylandt [mailto:michael.weylandt@gmail.com] > *Sent:* Friday, September 09, 2011 10:25 PM > *To:* Halabi, Anan > *Cc:* r-help@R-project.org > *Subject:* Re: [R] Reliability metric**** > > ** ** > > Your code works fine -- the warning message is just a heads up that the > object z/eta (which has length 111) does not quite match up with 1-h which > has length 10: usually this is a sign that the user defined something > improperly so R gives you a nice warning, but it doesn't halt the > calculation. > > As to what you mean about your metric not being created -- if it's "R" (odd > choice for a variable name given your platform) it sure seems to > exist....especially since you just gave us 111 values for it. > > Though I think you don't know what you mean by "[the] function R". Perhaps > you should read about how user defined functions are set up in R (the > fantastically useful insightful warning message giving language): > http://www.statmethods.net/management/userfunctions.html > > Michael Weylandt**** > > On Fri, Sep 9, 2011 at 2:14 PM, Halabi, Anan <anan.halabi@hp.com> wrote:** > ** > > > Hi, > Below is the code I write, > I am trying to create a metric of h and t while the values is out of > function R. > First I have message warning > Second, the metric is not created > > > > h <- seq(0.1, 0.9, by=0.1) > > t <- seq(0,11000, by=100) > > z <- cbind(t) > > eta=10000 > > beta=2 > > R <- array (1:1100, dim= c(110,10)) > > R= exp(-(z/eta*(1-h))^(beta*(1-h))) > Warning messages: > 1: In z/eta * (1 - h) : > longer object length is not a multiple of shorter object length > 2: In (z/eta * (1 - h))^(beta * (1 - h)) : > longer object length is not a multiple of shorter object length > > R > t > [1,] 1.0000000 > [2,] 0.9995586 > [3,] 0.9974647 > [4,] 0.9919725 > [5,] 0.9801987 > [6,] 0.9572081 > [7,] 0.9141353 > [8,] 0.8341665 > [9,] 0.6833618 > [10,] 0.9892125 > [11,] 0.9825766 > [12,] 0.9727664 > [13,] 0.9583520 > [14,] 0.9370675 > [15,] 0.9051390 > [16,] 0.8559267 > [17,] 0.7769472 > [18,] 0.6423128 > [19,] 0.9629361 > [20,] 0.9521001 > [21,] 0.9382259 > [22,] 0.9201104 > [23,] 0.8958341 > [24,] 0.8622051 > [25,] 0.8136275 > [26,] 0.7395534 > [27,] 0.6175830 > [28,] 0.9246320 > [29,] 0.9127580 > [30,] 0.8982795 > [31,] 0.8800821 > [32,] 0.8564152 > [33,] 0.8244048 > [34,] 0.7790512 > [35,] 0.7109198 > [36,] 0.5996181 > [37,] 0.8767646 > [38,] 0.8671159 > [39,] 0.8550329 > [40,] 0.8394499 > [41,] 0.8187308 > [42,] 0.7902253 > [43,] 0.7493487 > [44,] 0.6874269 > [45,] 0.5854263 > [46,] 0.8215803 > [47,] 0.8170930 > [48,] 0.8098560 > [49,] 0.7988930 > [50,] 0.7827045 > [51,] 0.7588540 > [52,] 0.7231046 > [53,] 0.6673758 > [54,] 0.5736597 > [55,] 0.7611968 > [56,] 0.7642511 > [57,] 0.7637415 > [58,] 0.7588504 > [59,] 0.7482636 > [60,] 0.7297788 > [61,] 0.6994875 > [62,] 0.6498159 > [63,] 0.5635906 > [64,] 0.6975913 > [65,] 0.7098972 > [66,] 0.7174446 > [67,] 0.7196221 > [68,] 0.7153381 > [69,] 0.7026455 > [70,] 0.6779572 > [71,] 0.6341555 > [72,] 0.5547793 > [73,] 0.6325678 > [74,] 0.6551296 > [75,] 0.6715521 > [76,] 0.6814181 > [77,] 0.6838614 > [78,] 0.6771931 > [79,] 0.6581383 > [80,] 0.6199984 > [81,] 0.5469392 > [82,] 0.5677232 > [83,] 0.6008650 > [84,] 0.6265229 > [85,] 0.6443861 > [86,] 0.6537698 > [87,] 0.6532207 > [88,] 0.6397566 > [89,] 0.6070646 > [90,] 0.5398727 > [91,] 0.5044222 > [92,] 0.5478565 > [93,] 0.5827146 > [94,] 0.6086282 > [95,] 0.6250023 > [96,] 0.6305684 > [97,] 0.6226043 > [98,] 0.5951486 > [99,] 0.5334377 > [100,] 0.4437834 > [101,] 0.4967086 > [102,] 0.5404019 > [103,] 0.5742126 > [104,] 0.5975006 > [105,] 0.6091056 > [106,] 0.6065193 > [107,] 0.5840942 > [108,] 0.5275280 > [109,] 0.3866770 > [110,] 0.4478912 > [111,] 0.4997913 > > length(R) > [1] 111 > > Anan Halabi > Reliability Eng, R&D > HP Scitex > Tel: 972-9-8924648 > mobil: 972-52-6624231 > > > [[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]]
On Sep 9, 2011, at 3:14 PM, Halabi, Anan wrote:> > Hi, > Below is the code I write, > I am trying to create a metric of h and t while the values is out of > function R. > First I have message warningIt is only a warning.> Second, the metric is not createdWhat "not created" means has already been question by Weylandt. What you seem to have missed in your introductory material is the concept of "recycling of arguments". Look at this code and its results: > (1:10) * (1:2) # [1] 1 4 3 8 5 12 7 16 9 20 > (1:10) * (1:3) # [1] 1 4 9 4 10 18 7 16 27 10 Warning message: In (1:10) * (1:3) : longer object length is not a multiple of shorter object length -- David.> > >> h <- seq(0.1, 0.9, by=0.1) >> t <- seq(0,11000, by=100) >> z <- cbind(t) >> eta=10000 >> beta=2 >> R <- array (1:1100, dim= c(110,10)) >> R= exp(-(z/eta*(1-h))^(beta*(1-h))) > Warning messages: > 1: In z/eta * (1 - h) : > longer object length is not a multiple of shorter object length > 2: In (z/eta * (1 - h))^(beta * (1 - h)) : > longer object length is not a multiple of shorter object length >> R > t > [1,] 1.0000000 > [2,] 0.9995586 > [3,] 0.9974647 > [4,] 0.9919725 > [5,] 0.9801987 > [6,] 0.9572081 > [7,] 0.9141353 > [8,] 0.8341665 > [9,] 0.6833618 > [10,] 0.9892125 > [11,] 0.9825766 > [12,] 0.9727664 > [13,] 0.9583520 > [14,] 0.9370675 > [15,] 0.9051390 > [16,] 0.8559267 > [17,] 0.7769472 > [18,] 0.6423128 > [19,] 0.9629361 > [20,] 0.9521001 > [21,] 0.9382259 > [22,] 0.9201104 > [23,] 0.8958341 > [24,] 0.8622051 > [25,] 0.8136275 > [26,] 0.7395534 > [27,] 0.6175830 > [28,] 0.9246320 > [29,] 0.9127580 > [30,] 0.8982795 > [31,] 0.8800821 > [32,] 0.8564152 > [33,] 0.8244048 > [34,] 0.7790512 > [35,] 0.7109198 > [36,] 0.5996181 > [37,] 0.8767646 > [38,] 0.8671159 > [39,] 0.8550329 > [40,] 0.8394499 > [41,] 0.8187308 > [42,] 0.7902253 > [43,] 0.7493487 > [44,] 0.6874269 > [45,] 0.5854263 > [46,] 0.8215803 > [47,] 0.8170930 > [48,] 0.8098560 > [49,] 0.7988930 > [50,] 0.7827045 > [51,] 0.7588540 > [52,] 0.7231046 > [53,] 0.6673758 > [54,] 0.5736597 > [55,] 0.7611968 > [56,] 0.7642511 > [57,] 0.7637415 > [58,] 0.7588504 > [59,] 0.7482636 > [60,] 0.7297788 > [61,] 0.6994875 > [62,] 0.6498159 > [63,] 0.5635906 > [64,] 0.6975913 > [65,] 0.7098972 > [66,] 0.7174446 > [67,] 0.7196221 > [68,] 0.7153381 > [69,] 0.7026455 > [70,] 0.6779572 > [71,] 0.6341555 > [72,] 0.5547793 > [73,] 0.6325678 > [74,] 0.6551296 > [75,] 0.6715521 > [76,] 0.6814181 > [77,] 0.6838614 > [78,] 0.6771931 > [79,] 0.6581383 > [80,] 0.6199984 > [81,] 0.5469392 > [82,] 0.5677232 > [83,] 0.6008650 > [84,] 0.6265229 > [85,] 0.6443861 > [86,] 0.6537698 > [87,] 0.6532207 > [88,] 0.6397566 > [89,] 0.6070646 > [90,] 0.5398727 > [91,] 0.5044222 > [92,] 0.5478565 > [93,] 0.5827146 > [94,] 0.6086282 > [95,] 0.6250023 > [96,] 0.6305684 > [97,] 0.6226043 > [98,] 0.5951486 > [99,] 0.5334377 > [100,] 0.4437834 > [101,] 0.4967086 > [102,] 0.5404019 > [103,] 0.5742126 > [104,] 0.5975006 > [105,] 0.6091056 > [106,] 0.6065193 > [107,] 0.5840942 > [108,] 0.5275280 > [109,] 0.3866770 > [110,] 0.4478912 > [111,] 0.4997913 >> length(R) > [1] 111 > > Anan Halabi > Reliability Eng, R&D > HP Scitex > Tel: 972-9-8924648 > mobil: 972-52-6624231 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.David Winsemius, MD West Hartford, CT
Reasonably Related Threads
- Matrix- create mean/min/max/stdev on column of matrix or rows?
- Removing slected values from original vector and definning new vector with the rest?
- Weibull- Random Censoring
- Weibull simulation- number of items to replace is not a multiple of replacement length
- Listing elements of a 4D array