Estimados, Tengo: v1 v_DEM_i_d_m Donde>IN_ES_NUM = 469>v1 = 1:IN_ES_NUM> head(v_DEM_i_d_m)Mes 1 Mes 2 Mes 3 Mes 4 Mes 5 Mes 6 Mes 7 Mes 8 Mes 9 Mes 10 Mes 11 Mes 12 ES 1 7.811032258 8.982678571 9.563935484 8.411500000 7.788354839 8.976933333 9.517419355 8.902258065 9.328600000 9.391096774 9.866800000 10.317838710 ES 2 0.641419355 1.174714286 1.353838710 1.299900000 1.387096774 0.905033333 1.140935484 0.880387097 1.237766667 1.292677419 1.327166667 1.387838710 ES 3 0.003225806 0.003571429 0.003225806 0.003333333 0.003225806 0.003333333 0.003225806 0.003225806 0.003333333 0.003225806 0.003333333 0.003483871 ES 4 13.475258065 13.240285714 15.168838710 11.492233333 12.792774194 12.989566667 14.996064516 12.911774194 13.835400000 14.635612903 14.541266667 15.206000000 ES 5 18.711258065 23.263535714 24.875967742 23.478000000 27.372548387 27.509800000 28.649096774 26.986935484 33.831833333 20.810419355 24.669400000 25.797096774 ES 6 16.112419355 17.903678571 18.250548387 16.712066667 17.353741935 17.137233333 18.501000000 17.613258065 19.115766667 20.773354839 20.990566667 21.950096774> class((v_DEM_i_d_m))[1] "matrix" "array"> str(v_DEM_i_d_m)num [1:469, 1:12] 7.81103 0.64142 0.00323 13.47526 18.71126 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:469] "ES 1" "ES 2" "ES 3" "ES 4" ... ..$ : chr [1:12] "Mes 1" "Mes 2" "Mes 3" "Mes 4" ... Si hago: for (i in idx_epsilon) { v1[i] = ceiling(max(v_DEM_i_d_m[i,])) } v1 queda así:> head(v1)1 2 3 4 5 6> class(v1)[1] "numeric"> str(v1)Named num [1:938] 1 2 3 4 5 6 7 8 9 10 ... - attr(*, "names")= chr [1:938] "" "" "" "" ... No entiendo porque los primeros 469 son los números de 1 a 469. ¿Que estoy haciendo mal? Saludos, Sebastián.
Estimado Sebastián Kruk Pueden ser datos confidenciales, si no lo son, y puedes enviar un script en R, yo puedo colocarlo en mi computadora tal cuál, que ejecute sin que yo toque nada, y ver si el resultado es el mismo. Por si es un problema de versión, sistema, algo que no dependa de usted. La semana pasada me pasó que el mismo código estaba andando en cuatro sistemas operativos diferentes y luego de una actualización un sistema comenzó a fallar. Mismo código, dependiendo dónde, daba resultados distintos, y con R ya pasó con fechas, entre distintas personas de esta lista de correos nos daba diferencias. Javier Rubén Marcuzzi> El 22 ago. 2022, a las 17:06, Sebastian Kruk <residuo.solow en gmail.com> escribió: > > Estimados, > > Tengo: > v1 > v_DEM_i_d_m > > Donde > >> IN_ES_NUM = 469 > >> v1 = 1:IN_ES_NUM > >> head(v_DEM_i_d_m) > Mes 1 Mes 2 Mes 3 Mes 4 Mes 5 > Mes 6 Mes 7 Mes 8 Mes 9 Mes 10 > Mes 11 Mes 12 > ES 1 7.811032258 8.982678571 9.563935484 8.411500000 7.788354839 > 8.976933333 9.517419355 8.902258065 9.328600000 9.391096774 > 9.866800000 10.317838710 > ES 2 0.641419355 1.174714286 1.353838710 1.299900000 1.387096774 > 0.905033333 1.140935484 0.880387097 1.237766667 1.292677419 > 1.327166667 1.387838710 > ES 3 0.003225806 0.003571429 0.003225806 0.003333333 0.003225806 > 0.003333333 0.003225806 0.003225806 0.003333333 0.003225806 > 0.003333333 0.003483871 > ES 4 13.475258065 13.240285714 15.168838710 11.492233333 12.792774194 > 12.989566667 14.996064516 12.911774194 13.835400000 14.635612903 > 14.541266667 15.206000000 > ES 5 18.711258065 23.263535714 24.875967742 23.478000000 27.372548387 > 27.509800000 28.649096774 26.986935484 33.831833333 20.810419355 > 24.669400000 25.797096774 > ES 6 16.112419355 17.903678571 18.250548387 16.712066667 17.353741935 > 17.137233333 18.501000000 17.613258065 19.115766667 20.773354839 > 20.990566667 21.950096774 > >> class((v_DEM_i_d_m)) > [1] "matrix" "array" > >> str(v_DEM_i_d_m) > num [1:469, 1:12] 7.81103 0.64142 0.00323 13.47526 18.71126 ... > - attr(*, "dimnames")=List of 2 > ..$ : chr [1:469] "ES 1" "ES 2" "ES 3" "ES 4" ... > ..$ : chr [1:12] "Mes 1" "Mes 2" "Mes 3" "Mes 4" ... > > Si hago: > > for (i in idx_epsilon) { > v1[i] = ceiling(max(v_DEM_i_d_m[i,])) > } > > v1 queda así: > >> head(v1) > > 1 2 3 4 5 6 > >> class(v1) > [1] "numeric" > >> str(v1) > Named num [1:938] 1 2 3 4 5 6 7 8 9 10 ... > - attr(*, "names")= chr [1:938] "" "" "" "" ... > > No entiendo porque los primeros 469 son los números de 1 a 469. > > ¿Que estoy haciendo mal? > > Saludos, > > Sebastián. > > _______________________________________________ > R-help-es mailing list > R-help-es en r-project.org > https://stat.ethz.ch/mailman/listinfo/r-help-es
Qué pasa cuando usas apply(v_fDEM_i_d_m, 1, function(x) ceiling(max(x))) ? Jorge.- El El lun, 22 de ago. de 2022 a la(s) 3:06 p. m., Sebastian Kruk < residuo.solow en gmail.com> escribió:> Estimados, > > Tengo: > v1 > v_DEM_i_d_m > > Donde > > >IN_ES_NUM = 469 > > >v1 = 1:IN_ES_NUM > > > head(v_fDEM_i_d_m) > Mes 1 Mes 2 Mes 3 Mes 4 Mes 5 > Mes 6 Mes 7 Mes 8 Mes 9 Mes 10 > Mes 11 Mes 12 > ES 1 7.811032258 8.982678571 9.563935484 8.411500000 7.788354839 > 8.976933333 9.517419355 8.902258065 9.328600000 9.391096774 > 9.866800000 10.317838710 > ES 2 0.641419355 1.174714286 1.353838710 1.299900000 1.387096774 > 0.905033333 1.140935484 0.880387097 1.237766667 1.292677419 > 1.327166667 1.387838710 > ES 3 0.003225806 0.003571429 0.003225806 0.003333333 0.003225806 > 0.003333333 0.003225806 0.003225806 0.003333333 0.003225806 > 0.003333333 0.003483871 > ES 4 13.475258065 13.240285714 15.168838710 11.492233333 12.792774194 > 12.989566667 14.996064516 12.911774194 13.835400000 14.635612903 > 14.541266667 15.206000000 > ES 5 18.711258065 23.263535714 24.875967742 23.478000000 27.372548387 > 27.509800000 28.649096774 26.986935484 33.831833333 20.810419355 > 24.669400000 25.797096774 > ES 6 16.112419355 17.903678571 18.250548387 16.712066667 17.353741935 > 17.137233333 18.501000000 17.613258065 19.115766667 20.773354839 > 20.990566667 21.950096774 > > > class((v_DEM_i_d_m)) > [1] "matrix" "array" > > > str(v_DEM_i_d_m) > num [1:469, 1:12] 7.81103 0.64142 0.00323 13.47526 18.71126 ... > - attr(*, "dimnames")=List of 2 > ..$ : chr [1:469] "ES 1" "ES 2" "ES 3" "ES 4" ... > ..$ : chr [1:12] "Mes 1" "Mes 2" "Mes 3" "Mes 4" ... > > Si hago: > > for (i in idx_epsilon) { > v1[i] = ceiling(max(v_DEM_i_d_m[i,])) > } > > v1 queda así: > > > head(v1) > > 1 2 3 4 5 6 > > > class(v1) > [1] "numeric" > > > str(v1) > Named num [1:938] 1 2 3 4 5 6 7 8 9 10 ... > - attr(*, "names")= chr [1:938] "" "" "" "" ... > > No entiendo porque los primeros 469 son los números de 1 a 469. > > ¿Que estoy haciendo mal? > > Saludos, > > Sebastián. > > _______________________________________________ > R-help-es mailing list > R-help-es en r-project.org > https://stat.ethz.ch/mailman/listinfo/r-help-es >-- Sent from my phone. Please excuse my brevity and misspelling. [[alternative HTML version deleted]]
Marcelino de la Cruz Rot
2022-Aug-24 08:49 UTC
[R-es] ceiling con max duplica tamaño matriz
Hola Sebastián: No nos has enseñado cómo es idx_epsilon. Haz head(idx_epsilon) y comprueba que sus valores vayan de 1 a 469. Si no incluyen estos valores es normal que después del bucle las posiciones 1:469 de v1 se queden como estaban. Saludos, Marcelino El 22/08/2022 a las 22:06, Sebastian Kruk escribió:> Estimados, > > Tengo: > v1 > v_DEM_i_d_m > > Donde > >> IN_ES_NUM = 469 >> v1 = 1:IN_ES_NUM >> head(v_DEM_i_d_m) > Mes 1 Mes 2 Mes 3 Mes 4 Mes 5 > Mes 6 Mes 7 Mes 8 Mes 9 Mes 10 > Mes 11 Mes 12 > ES 1 7.811032258 8.982678571 9.563935484 8.411500000 7.788354839 > 8.976933333 9.517419355 8.902258065 9.328600000 9.391096774 > 9.866800000 10.317838710 > ES 2 0.641419355 1.174714286 1.353838710 1.299900000 1.387096774 > 0.905033333 1.140935484 0.880387097 1.237766667 1.292677419 > 1.327166667 1.387838710 > ES 3 0.003225806 0.003571429 0.003225806 0.003333333 0.003225806 > 0.003333333 0.003225806 0.003225806 0.003333333 0.003225806 > 0.003333333 0.003483871 > ES 4 13.475258065 13.240285714 15.168838710 11.492233333 12.792774194 > 12.989566667 14.996064516 12.911774194 13.835400000 14.635612903 > 14.541266667 15.206000000 > ES 5 18.711258065 23.263535714 24.875967742 23.478000000 27.372548387 > 27.509800000 28.649096774 26.986935484 33.831833333 20.810419355 > 24.669400000 25.797096774 > ES 6 16.112419355 17.903678571 18.250548387 16.712066667 17.353741935 > 17.137233333 18.501000000 17.613258065 19.115766667 20.773354839 > 20.990566667 21.950096774 > >> class((v_DEM_i_d_m)) > [1] "matrix" "array" > >> str(v_DEM_i_d_m) > num [1:469, 1:12] 7.81103 0.64142 0.00323 13.47526 18.71126 ... > - attr(*, "dimnames")=List of 2 > ..$ : chr [1:469] "ES 1" "ES 2" "ES 3" "ES 4" ... > ..$ : chr [1:12] "Mes 1" "Mes 2" "Mes 3" "Mes 4" ... > > Si hago: > > for (i in idx_epsilon) { > v1[i] = ceiling(max(v_DEM_i_d_m[i,])) > } > > v1 queda así: > >> head(v1) > 1 2 3 4 5 6 > >> class(v1) > [1] "numeric" > >> str(v1) > Named num [1:938] 1 2 3 4 5 6 7 8 9 10 ... > - attr(*, "names")= chr [1:938] "" "" "" "" ... > > No entiendo porque los primeros 469 son los números de 1 a 469. > > ¿Que estoy haciendo mal? > > Saludos, > > Sebastián. > > _______________________________________________ > R-help-es mailing list > R-help-es en r-project.org > https://stat.ethz.ch/mailman/listinfo/r-help-es-- Marcelino de la Cruz Rot Depto. de Biología y Geología Física y Química Inorgánica Universidad Rey Juan Carlos Móstoles España
Buenas, Sebastin: No veo qu valor asignas a idx_epsilon. Un saludo. El 22/8/22 a las 22:06, Sebastian Kruk escribi:> Estimados, > > Tengo: > v1 > v_DEM_i_d_m > > Donde > >> IN_ES_NUM = 469 >> v1 = 1:IN_ES_NUM >> head(v_DEM_i_d_m) > Mes 1 Mes 2 Mes 3 Mes 4 Mes 5 > Mes 6 Mes 7 Mes 8 Mes 9 Mes 10 > Mes 11 Mes 12 > ES 1 7.811032258 8.982678571 9.563935484 8.411500000 7.788354839 > 8.976933333 9.517419355 8.902258065 9.328600000 9.391096774 > 9.866800000 10.317838710 > ES 2 0.641419355 1.174714286 1.353838710 1.299900000 1.387096774 > 0.905033333 1.140935484 0.880387097 1.237766667 1.292677419 > 1.327166667 1.387838710 > ES 3 0.003225806 0.003571429 0.003225806 0.003333333 0.003225806 > 0.003333333 0.003225806 0.003225806 0.003333333 0.003225806 > 0.003333333 0.003483871 > ES 4 13.475258065 13.240285714 15.168838710 11.492233333 12.792774194 > 12.989566667 14.996064516 12.911774194 13.835400000 14.635612903 > 14.541266667 15.206000000 > ES 5 18.711258065 23.263535714 24.875967742 23.478000000 27.372548387 > 27.509800000 28.649096774 26.986935484 33.831833333 20.810419355 > 24.669400000 25.797096774 > ES 6 16.112419355 17.903678571 18.250548387 16.712066667 17.353741935 > 17.137233333 18.501000000 17.613258065 19.115766667 20.773354839 > 20.990566667 21.950096774 > >> class((v_DEM_i_d_m)) > [1] "matrix" "array" > >> str(v_DEM_i_d_m) > num [1:469, 1:12] 7.81103 0.64142 0.00323 13.47526 18.71126 ... > - attr(*, "dimnames")=List of 2 > ..$ : chr [1:469] "ES 1" "ES 2" "ES 3" "ES 4" ... > ..$ : chr [1:12] "Mes 1" "Mes 2" "Mes 3" "Mes 4" ... > > Si hago: > > for (i in idx_epsilon) { > v1[i] = ceiling(max(v_DEM_i_d_m[i,])) > } > > v1 queda as: > >> head(v1) > 1 2 3 4 5 6 > >> class(v1) > [1] "numeric" > >> str(v1) > Named num [1:938] 1 2 3 4 5 6 7 8 9 10 ... > - attr(*, "names")= chr [1:938] "" "" "" "" ... > > No entiendo porque los primeros 469 son los nmeros de 1 a 469. > > Que estoy haciendo mal? > > Saludos, > > Sebastin. > > _______________________________________________ > R-help-es mailing list > R-help-es en r-project.org > https://stat.ethz.ch/mailman/listinfo/r-help-es > Return-Path: <r-help-es-bounces en r-project.org> > Delivered-To: cuentar en buzon9.uca.es > Received: from buzon9.uca.es > by buzon9.uca.es with LMTP > id gEkuOtSS6mITUgAATVNi1Q > (envelope-from <r-help-es-bounces en r-project.org>) > for <cuentar en buzon9.uca.es>; Wed, 03 Aug 2022 17:23:00 +0200 > Received: from smtp22.uca.es (bellatrix.uca.es [10.84.3.16]) > by buzon9.uca.es (Postfix) with ESMTP id EDB00120431 > for <cuentar en buzon9.uca.es>; Wed, 3 Aug 2022 17:23:00 +0200 (CEST) > Received: from localhost (localhost [127.0.0.1]) > by smtp22.uca.es (Postfix) with ESMTP id EAE9B600E5 > for <cuentar en buzon9.uca.es>; Wed, 3 Aug 2022 17:23:00 +0200 (CEST) > Authentication-Results: smtp22.uca.es (amavisd-new); dkim=ss (1024-bit key) > header.d=project.org > Received: from smtp22.uca.es ([127.0.0.1]) > by localhost (smtp22.uca.es [127.0.0.1]) (amavisd-new, port 10024) > with LMTP id uCsQhgWulO0z for <cuentar en buzon9.uca.es>; > Wed, 3 Aug 2022 17:23:00 +0200 (CEST) > Received: from mx02.puc.rediris.es (outbound1sev.lav.puc.rediris.es [130.206.19.170]) > by smtp22.uca.es (Postfix) with ESMTPS id CAFAE600E3 > for <r-uca en uca.es>; Wed, 3 Aug 2022 17:23:00 +0200 (CEST) > Authentication-Results: mx02.puc.rediris.es; > spf=ss (rediris.es: domain of r-help-es-bounces en r-project.org designates 129.132.119.208 as permitted sender) smtp.mailfrom=r-help-es-bounces en r-project.org; > dkim=ss header.i=@r-project.org > Received: from hypatia.math.ethz.ch (hypatia.math.ethz.ch [129.132.119.208]) > by mx02.puc.rediris.es with ESMTP id 273FMxpp005763-273FMxpr005763 > (version=Sv1.2 cipherDHE-RSA-AES256-GCM-SHA384 bits%6 verify=NO) > for <r-uca en uca.es>; Wed, 3 Aug 2022 17:22:59 +0200 > Received: from localhost (localhost [127.0.0.1]) > by hypatia.math.ethz.ch (Postfix) with ESMTP id E9669E55; > Wed, 3 Aug 2022 17:22:58 +0200 (CEST) > DKIM-Signature: v= a=rsa-sha256; c=relaxed/simple; d=r-project.org; h content-transfer-encoding:content-type:content-type > :list-subscribe:list-help:list-post:list-archive > :list-unsubscribe:list-id:precedence:subject:subject:message-id > :date:date:from:from:mime-version:received:received:received > :received:received:received:received; s=im20211220; t 1659540178; x62132179; bhygmbSEvIN6C0kLWWD8wwyCyanahf5CboV > kCOW1InE=b=O1rK0aSk9JiEIbPGO2rbvfSReXPi+OTtIHpesudLTCb5s90KVzj > 41laTdi4h2pSKA73IfAYqtu8CQQ3d0D3sdv9t4U/G/CgKOWz0T3w1EXEgSn2bQg4 > ExpXmU+LQa1S8k0fqyravKy7EmD/ZceMUT0UftTuDnYiIyIbx0wO8S2AX-Virus-Scanned: amavisd-new at r-project.org > Received: from hypatia.math.ethz.ch ([127.0.0.1]) > by localhost (hypatia.math.ethz.ch [127.0.0.1]) (amavisd-new, port 10024) > with LMTP id bE3c2oFIs0ot; Wed, 3 Aug 2022 17:22:58 +0200 (CEST) > Received: from hypatia.math.ethz.ch (localhost [127.0.0.1]) > by hypatia.math.ethz.ch (Postfix) with ESMTP id 8D4F61EB0; > Wed, 3 Aug 2022 17:22:53 +0200 (CEST) > Received: from localhost (localhost [127.0.0.1]) > by hypatia.math.ethz.ch (Postfix) with ESMTP id 0874D652 > for <r-help-es en r-project.org>; Wed, 3 Aug 2022 17:22:52 +0200 (CEST) > X-Virus-Scanned: amavisd-new at r-project.org > X-Spam-Flag: NO > X-Spam-Score: 0.161 > X-Spam-Level: > X-Spam-Status: No, score=161 tagged_above=-999 required=6.2 > tests=AYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, > DKIM_VALID_AU=.1, FORGED_SPF_HELO=1, > FREEMAIL_FORGED_FROMDOMAIN=0248, FREEMAIL_FROM=0.001, > HEADER_FROM_DIFFERENT_DOMAINS=248, SPF_HELO_PASS=-0.001, > SPF_SOFTFAIL=665] autolearn=no autolearn_force=no > Received: from hypatia.math.ethz.ch ([127.0.0.1]) > by localhost (hypatia.math.ethz.ch [127.0.0.1]) (amavisd-new, port 10024) > with LMTP id qCGJfLYz_8S5 for <r-help-es en r-project.org>; > Wed, 3 Aug 2022 17:22:47 +0200 (CEST) > Received: from ethz.ch (mc1.ethz.ch [129.132.80.150]) > (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) > (No client certificate requested) > by hypatia.math.ethz.ch (Postfix) with ESMTPS id 896B3E55 > for <r-help-es en r-project.org>; Wed, 3 Aug 2022 17:22:47 +0200 (CEST) > Received: from mail-il1-f170.google.com ([209.85.166.170]) > by ethz.ch stage1 with esmtps (Exim MailCleaner) > id 1oJGCY-00039I-Jv for <r-help-es en r-project.org> > from <residuo.solow en gmail.com>; Wed, 03 Aug 2022 17:22:26 +0200 > Received: by mail-il1-f170.google.com with SMTP id g14so3982956ile.11 > for <r-help-es en r-project.org>; Wed, 03 Aug 2022 08:22:26 -0700 (PDT) > X-MailCleaner-SPF: pass > X-Google-DKIM-Signature: v= a=rsa-sha256; c=relaxed/relaxed; > d100.net; s 210112;> h=ntent-transfer-encoding:to:subject:message-id:date:from > :mime-version:x-gm-message-state:from:to:cc; > bh=WLxmAnsIOOynn+5yRdphCblQt6+2ybaZlEyE24kZE=; > b=SjD+vzAWfmKwjV/ixl9ef8kMSjDpbjemDAEveJybIJmk5WNYEUF7aUXPkqjdW1igwr > QJiu/1sY3HB5QR+LJXglbe9DJlFUwuFYNX/i9Ltp5ozV9raDTyt4jx2k/JtCO/J+gVIE > LOdVNZDN26SSIuFCA7t8PdBW2kgyQMWUQ/u2LW6OuBF0oNPdWyDd4uN/Vw15NUXUciAe > xcHPTar9hdeCvQZpsaWqn8bpdbB+Ns853zmzXBHbS1nRtWqpb0HMK0iO5kWhPqTOljwG > vUkMjmeezlLYhIe05pjSELvnqcz68bjorsVkARSfXp/qLk02c0IS8CvATsnZgm4NJFUg > KMzQ=X-Gm-Message-State: AJIora8il7dg3XsAt6wmwYUUAnu4lol+LT9Ce1I5+T9dNWhET3qVKV06 > WeOql6MybYgtkkHiEgogckC+YyPoT5uj9i1lJ0BCclI9mN2y+A=X-Google-Smtp-Source: AGRyM1tqeufBEs6oS5HawbBkNWLxPgDiQYTBQnfeUEhEVfy7cApP3kEN92xFN8Ud4q+uD2V8cA0JA055r00ZSdStlFIX-Received: by 2002:a05:6e02:1c86:b0:2de:89f:ccd1 with SMTP id > w6-20020a056e021c8600b002de089fccd1mr10638086ill.5.1659540144772; Wed, 03 Aug > 2022 08:22:24 -0700 (PDT) > MIME-Version: 1.0 > From: Sebastian Kruk <residuo.solow en gmail.com> > Date: Wed, 3 Aug 2022 12:22:51 -0300 > Message-ID: <CAMn86NexyY9pqjtoCAt7PLj4F0Rx9EG6NF3gMi8RKxvHcc3GCg en mail.gmail.com> > To: Lista R <r-help-es en r-project.org> > X-Newsl: is not newsletter (2.0/5.0) position : 0, not decisive > X-MailCleaner-MachineLearning0: is not spam (23.714926838874817%) > (200728-ALL-10L) (es) > X-MailCleaner-MachineLearning1: is not spam (92.98120141029358%) > (200728-ALL-50S) (es) > X-NiceBayes: is not spam (50.13%) position : 3, not decisive > X-Spamc: is not spam (0.0/5.0) position : 7, ham decisive > X-MailCleaner-Information: Please contact servicedesk en id.ethz.ch for more > information > X-MailCleaner-ID: 1oJGCY-00039v-Oi > X-MailCleaner: Found to be clean > X-MailCleaner-SpamCheck: not spam, Newsl (score=0, required=5.0, > MC_NEWS_NIPRBL= position : 0, not decisive), > MachineLearning (23.714926838874817% es, position : 2, not decisive), > MachineLearning (92.98120141029358% es, position : 2, not decisive), > NiceBayes (50.13%, position : 3, not decisive), Spamc (score=0, > required=0, FREEMAIL_FROM 0.0, RCVD_IN_DNSWL_NONE -0.0, > DKIM_VALID -0.3, MC_SPF_PASS -0.0, DKIM_VALID_AU -0.3, > RCVD_IN_MSPIKE_H2 -0.0, DKIM_SIGNED 0.6, position : 7, ham decisive) > X-MailCleaner-ReportURL: https://mailcleaner.ethz.ch/rs.php > Subject: [R-es] Rglpk_solve_LP > X-BeenThere: r-help-es en r-project.org > X-Mailman-Version: 2.1.25+j1 > Precedence: list > List-Id: =so-8859-1?q?Ayuda_sobre_R_en_espaol?= <r-help-es.r-project.org> > List-Unsubscribe: <https://stat.ethz.ch/mailman/options/r-help-es>, > <mailto:r-help-es-request en r-project.org?subject=subscribe> > List-Archive: <https://stat.ethz.ch/pipermail/r-help-es/> > List-Post: <mailto:r-help-es en r-project.org> > List-Help: <mailto:r-help-es-request en r-project.org?subject=lp> > List-Subscribe: <https://stat.ethz.ch/mailman/listinfo/r-help-es>, > <mailto:r-help-es-request en r-project.org?subject=bscribe> > Content-Type: text/plain; charset=so-8859-1" > Content-Transfer-Encoding: quoted-printable > Errors-To: r-help-es-bounces en r-project.org > Sender: "R-help-es" <r-help-es-bounces en r-project.org> > X-FEAS-SPF: spf-result=ss, ip9.132.119.208, helo=hypatia.math.ethz.ch, mailFrom=r-help-es-bounces en r-project.org > X-FEAS-DKIM: Valid > X-FE-Policy-ID: 21:3:1:uca.es > > Estimados usuarios-R: > > Estoy probando el solver GLPK. > > Me pasaron un programa en Octave y lo convert a R pero me da siempre > que la solucin es 0. > > En R me qued as: > > ###################################################### > > #1) Datos > > #Perodo de estudio (das) > T = 10 > > #Demanda diaria > dda = 10*matrix(1,T,1) > > #Capacidad de camin (m3) > K=30 > > #Capacidad de tanque (m3) > cap_tqe=40 > > #Stock inicial (m3) > s0=15 > > #Max cantdad diaria de camiones > x_max=10 > > ################################## > #2) Modelo simple, puede entregar todos los das, camiones enteros > # > # Variables: z=[x; s], cant camiones x(t) y stock final s(t) > c = matrix(rep(1:0,each = T)) > vlb = matrix(rep(0,2*T)) > vub = matrix(c(x_max*rep(1,T),cap_tqe*rep(1,T))) > > #Rest de balance: s(t)=s(t-1)+K*x(t)-dda(t) > A1=matrix(0,nrow=T,ncol=2*T) > A1[,1:T]=diag(K,dim(A1[,1:T])) > T2 = T+1 > T3 = 2*T > library(pracma) > A1[,T2:T3]=-diag(1,T,T)+Diag(rep(1,T-1),-1) > b1 = dda > b1[1] = b1[1]-s0 > > #Tipo de variables y restricciones > varint=rep("I",T) > varcont=rep("C",T) > ctype=rep("S",T) > > #vartype=[varint varcont]; > vartype=c(varcont, varcont) > #----- > sense=1; > > Rglpk_solve_LP(obj = c, mat =A1, dir = rep("<=",nrow(A1)),rhs = b1,max > = F, types = vartype) > > ###################################################### > > Cul ser el problema? > > Gracias, > > Sebastin. > > _______________________________________________ > R-help-es mailing list > R-help-es en r-project.org > https://stat.ethz.ch/mailman/listinfo/r-help-es