Dear R users; I want to convert a rectangle into 2 new rectangles. I have a rectangle (18 m * 200 m), and I want to subtract 45 percent of it's area as a new rectangle. Is it possible to do this in R? Sincerely. [[alternative HTML version deleted]]
Yes it is possible, but contingent on exactly what you want to do and the form of your data. Is this a picture with a rectangle, or is this a rectangular matrix? If there is one pixel per square meter then the matrix has dimensions 18 by 200. 45% of 200 is 90. Mat <- matrix(0, nrow=18, ncol=200) Mat1 <- Mat[,1:90] Mat2 <- Mat[,91:200] If this is a graphical question, my thought would be to try Python. You would have to get Python to identify the rectangle and then give it some rules to split the rectangle. Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of javad bayat Sent: Tuesday, April 26, 2022 5:21 AM To: R-help at r-project.org Subject: [R] Convert one rectangle into two rectangles [External Email] Dear R users; I want to convert a rectangle into 2 new rectangles. I have a rectangle (18 m * 200 m), and I want to subtract 45 percent of it's area as a new rectangle. Is it possible to do this in R? Sincerely. [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=IT-iqd3VDNxH2pOQdJCv8la_J55nS5LrQMIs0gfoO4vYuZZXZdcV4UNweZVSctI6&s=2r0VJdEfq7-vH9GlxUtWS1235uMTfJyX2BUMRfTtmlk&ePLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=IT-iqd3VDNxH2pOQdJCv8la_J55nS5LrQMIs0gfoO4vYuZZXZdcV4UNweZVSctI6&s=pcSG7rjvhu775rq8Y8piGcqBjUz8fzP4m52PU17pUXg&eand provide commented, minimal, self-contained, reproducible code.
>>> Is it possible to do this in R?Is it possible? Yes, I am sure if it can be done in any language, it can also be done in R. The real question is do you have an algorithm you can come up with to try?to implement in R or?any other method? You know the lengths of your initial rectangle. So you can calculate your?area. You can also calculate what 45% and 55% of that area is. Hint: are you being asked to make two totally new rectangles?with an infinite number of solutions, or subdivide the existing?rectangle into two joined parts? That can lead to two fairly easy answers. -----Original Message----- From: javad bayat <j.bayat194 at gmail.com> To: R-help at r-project.org Sent: Tue, Apr 26, 2022 5:20 am Subject: [R] Convert one rectangle into two rectangles Dear R users; I want to convert a rectangle into 2 new rectangles. I have a rectangle (18 m * 200 m), and I want to subtract 45 percent of it's area as a new rectangle. Is it possible to do this in R? Sincerely. ??? [[alternative HTML version deleted]] ______________________________________________ R-help at 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. [[alternative HTML version deleted]]
Hi javad, Let's think about it a little. There are only two ways you can divide a rectangle into two other rectangles. The dividing line must be straight and parallel to one side or the other or you won't get two rectangles. If there are no other constraints, you can take your pick. A E B ------------------------------------- | | | ------------------------------------- C F D AE = CF = 0.45 * AB Alternatively the same equation can be used on the shorter sides. If you want to cut it across the length, you can do it with an abacus. While the IrregLong package can produce an abacus plot, I was unable to find an R-based abacus. For that I suggest: https://toytheater.com/abacus/ Jim On Wed, Apr 27, 2022 at 1:42 AM javad bayat <j.bayat194 at gmail.com> wrote:> > Dear R users; > I want to convert a rectangle into 2 new rectangles. I have a rectangle (18 > m * 200 m), and I want to subtract 45 percent of it's area as a new > rectangle. Is it possible to do this in R? > Sincerely. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.