Re: [R] importing data error question

2019-01-14 Thread Fox, John
Dear jihee,

> On Jan 14, 2019, at 9:00 PM, 우지희  wrote:
> 
> You said previously that you were using a Mac, so I'm surprised that you now 
> say that you're using Windows. I don't have a Windows 7 system, but I can 
> confirm that importing from Excel files works perfectly fine under Windows 
> 10, as I just verified, and I'd be surprised if the Windows version matters. 
> 
> --> no, I never said i was using a Mac. 

Sorry, I guess I got that from the error message you originally reported, which 
was "Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : 
[tcl] bad Macintosh file type "“*”"." I've never seen that error and it seems 
peculiar that it would occur on a Windows system.

> 
> You still haven't reported the versions of R, the Rcmdr package, and the 
> other packages that you're using. The easiest way to do this is to show the 
> output of the sessionInfo() command. 
> 
> --> sessionInfo()
> R version 3.5.2 (2018-12-20)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
> 
> Matrix products: default
> 
> locale:
> [1] LC_COLLATE=Korean_Korea.949  LC_CTYPE=Korean_Korea.949   
> [3] LC_MONETARY=Korean_Korea.949 LC_NUMERIC=C
> [5] LC_TIME=Korean_Korea.949
> 
> attached base packages:
> [1] tcltk splines   stats graphics  grDevices utils datasets  
> methods  
> [9] base 
> 
> other attached packages:
>  [1] RcmdrPlugin.SensoMineR_1.11-01 RcmdrPlugin.FactoMineR_1.6-0  
>  [3] Rcmdr_2.5-1effects_4.1-0 
>  [5] RcmdrMisc_2.5-1sandwich_2.5-0
>  [7] car_3.0-2  carData_3.0-2 
>  [9] SensoMineR_1.23FactoMineR_1.41   
> 
> loaded via a namespace (and not attached):
>  [1] gtools_3.8.1 Formula_1.2-3latticeExtra_0.6-28 
>  [4] cellranger_1.1.0 pillar_1.3.1 backports_1.1.3 
>  [7] lattice_0.20-38  digest_0.6.18RColorBrewer_1.1-2  
> [10] checkmate_1.8.5  minqa_1.2.4  colorspace_1.3-2
> [13] survey_3.35  htmltools_0.3.6  Matrix_1.2-15   
> [16] plyr_1.8.4   pkgconfig_2.0.2  haven_2.0.0 
> [19] scales_1.0.0 openxlsx_4.1.0   rio_0.5.16  
> [22] lme4_1.1-19  htmlTable_1.13.1 tibble_1.4.2
> [25] relimp_1.0-5 ggplot2_3.1.0nnet_7.3-12 
> [28] lazyeval_0.2.1   survival_2.43-3  magrittr_1.5
> [31] crayon_1.3.4 readxl_1.2.0 nlme_3.1-137
> [34] MASS_7.3-51.1forcats_0.3.0foreign_0.8-71  
> [37] class_7.3-14 tools_3.5.2  data.table_1.11.8   
> [40] hms_0.4.2tcltk2_1.2-11stringr_1.3.1   
> [43] munsell_0.5.0cluster_2.0.7-1  zip_1.0.0   
> [46] flashClust_1.01-2compiler_3.5.2   e1071_1.7-0 
> [49] rlang_0.3.1  grid_3.5.2   nloptr_1.2.1
> [52] rstudioapi_0.9.0 htmlwidgets_1.3  leaps_3.0   
> [55] base64enc_0.1-3  gtable_0.2.0 abind_1.4-5 
> [58] curl_3.2 reshape2_1.4.3   AlgDesign_1.1-7.3   
> [61] gridExtra_2.3zoo_1.8-4knitr_1.21  
> [64] nortest_1.0-4Hmisc_4.1-1  KernSmooth_2.23-15  
> [67] stringi_1.2.4Rcpp_1.0.0   rpart_4.1-13
> [70] acepack_1.4.1scatterplot3d_0.3-41 xfun_0.4
> 
> This was the status that I tried to import Excel data. 

These packages seem up-to-date.

> 
> Also, have you tried importing an Excel file in the Rcmdr *without* the two 
> plug-in packages loaded, as I suggested in my original response?  
> 
> --> I tried without plug-in packages, but It didn't work. 

OK, so you tried the setup that works for me and, I assume from the lack of 
similar error reports, for others.

> 
> It occurs to me that the problem may be produced by using the Rcmdr under R 
> with a non-Latin set, but if that were the case I would have expected the 
> problem to have surfaced earlier. Did you try reading another kind of file, 
> such as a plain-text data file? 
> 
> --> I don't know what is plain-text data file. 

A plain-text data file could, e.g., be created from an Excel file by exporting 
a worksheet as a .csv (comma-separated-values) file; you could read this into 
the Rcmdr via Data > Import data > from text file, specifying the field 
separator as commas.

> 
> i'll try R with English. 

I'm curious to see what happens.

Best,
 John

> 
> From:  "Fox, John"  
> 
> Sent: Monday, January 14, 2019 11:15:36 PM 
> 
> To:"우지희"  
> 
> Cc:""  
> 
> Subject:Re: [R] importing data error question 
> 
>Dear jihee,
> 
>> On Jan 13, 2019, at 9:28 PM, 우지희  wrote:
>> 
>> 
>> 
>> From: "우지희" 
>> Sent: Monday, January 14, 2019 9:40:26 AM
>> To:"Fox, John" 
>> Subject:Re: [R] importing data error question
>> 
>> 
>> Thanks for your replies.
>> 

Re: [R] importing data error question

2019-01-14 Thread 우지희
You said previously that you were using a Mac, so I'm surprised that you now 
say that you're using Windows. I don't have a Windows 7 system, but I can 
confirm that importing from Excel files works perfectly fine under Windows 10, 
as I just verified, and I'd be surprised if the Windows version matters. 

--> no, I never said i was using a Mac. 

You still haven't reported the versions of R, the Rcmdr package, and the other 
packages that you're using. The easiest way to do this is to show the output of 
the sessionInfo() command. 

--> sessionInfo()
 R version 3.5.2 (2018-12-20)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 Running under: Windows 7 x64 (build 7601) Service Pack 1

 Matrix products: default

 locale:
 [1] LC_COLLATE=Korean_Korea.949  LC_CTYPE=Korean_Korea.949   
 [3] LC_MONETARY=Korean_Korea.949 LC_NUMERIC=C                
 [5] LC_TIME=Korean_Korea.949    

 attached base packages:
 [1] tcltk     splines   stats     graphics  grDevices utils     datasets  
methods  
 [9] base     

 other attached packages:
  [1] RcmdrPlugin.SensoMineR_1.11-01 RcmdrPlugin.FactoMineR_1.6-0  
  [3] Rcmdr_2.5-1                    effects_4.1-0                 
  [5] RcmdrMisc_2.5-1                sandwich_2.5-0                
  [7] car_3.0-2                      carData_3.0-2                 
  [9] SensoMineR_1.23                FactoMineR_1.41               

 loaded via a namespace (and not attached):
  [1] gtools_3.8.1         Formula_1.2-3        latticeExtra_0.6-28 
  [4] cellranger_1.1.0     pillar_1.3.1         backports_1.1.3     
  [7] lattice_0.20-38      digest_0.6.18        RColorBrewer_1.1-2  
 [10] checkmate_1.8.5      minqa_1.2.4          colorspace_1.3-2    
 [13] survey_3.35          htmltools_0.3.6      Matrix_1.2-15       
 [16] plyr_1.8.4           pkgconfig_2.0.2      haven_2.0.0         
 [19] scales_1.0.0         openxlsx_4.1.0       rio_0.5.16          
 [22] lme4_1.1-19          htmlTable_1.13.1     tibble_1.4.2        
 [25] relimp_1.0-5         ggplot2_3.1.0        nnet_7.3-12         
 [28] lazyeval_0.2.1       survival_2.43-3      magrittr_1.5        
 [31] crayon_1.3.4         readxl_1.2.0         nlme_3.1-137        
 [34] MASS_7.3-51.1        forcats_0.3.0        foreign_0.8-71      
 [37] class_7.3-14         tools_3.5.2          data.table_1.11.8   
 [40] hms_0.4.2            tcltk2_1.2-11        stringr_1.3.1       
 [43] munsell_0.5.0        cluster_2.0.7-1      zip_1.0.0           
 [46] flashClust_1.01-2    compiler_3.5.2       e1071_1.7-0         
 [49] rlang_0.3.1          grid_3.5.2           nloptr_1.2.1        
 [52] rstudioapi_0.9.0     htmlwidgets_1.3      leaps_3.0           
 [55] base64enc_0.1-3      gtable_0.2.0         abind_1.4-5         
 [58] curl_3.2             reshape2_1.4.3       AlgDesign_1.1-7.3   
 [61] gridExtra_2.3        zoo_1.8-4            knitr_1.21          
 [64] nortest_1.0-4        Hmisc_4.1-1          KernSmooth_2.23-15  
 [67] stringi_1.2.4        Rcpp_1.0.0           rpart_4.1-13        
 [70] acepack_1.4.1        scatterplot3d_0.3-41 xfun_0.4            

This was the status that I tried to import Excel data. 

Also, have you tried importing an Excel file in the Rcmdr *without* the two 
plug-in packages loaded, as I suggested in my original response?  

--> I tried without plug-in packages, but It didn't work. 

 It occurs to me that the problem may be produced by using the Rcmdr under R 
with a non-Latin set, but if that were the case I would have expected the 
problem to have surfaced earlier. Did you try reading another kind of file, 
such as a plain-text data file? 

--> I don't know what is plain-text data file. 

i'll try R with English. 

From:  "Fox, John"  

Sent: Monday, January 14, 2019 11:15:36 PM 

To:"우지희"  

Cc:""  

Subject:Re: [R] importing data error question 

   Dear jihee,

  > On Jan 13, 2019, at 9:28 PM, 우지희  wrote:
  > 
  > 
  > 
  > From: "우지희" 
  > Sent: Monday, January 14, 2019 9:40:26 AM
  > To:"Fox, John" 
  > Subject:Re: [R] importing data error question
  > 
  > 
  > Thanks for your replies.
  > 
  > I'm using windows 7, I loaded FactoMineR,

 You said previously that you were using a Mac, so I'm surprised that you now 
say that you're using Windows. I don't have a Windows 7 system, but I can 
confirm that importing from Excel files works perfectly fine under Windows 10, 
as I just verified, and I'd be surprised if the Windows version matters.

  > SensoMineR and then Rcmdr. (Downloaded FacroMineR, SensoMineR, Rcmdr, 
Rcmdrplugin.FactomineR, Rcmdrplugin.SensomineR and other required packages that 
downloaded automatically)
  > This problem occurred when I select Data > Import data > From Excel file.
  > I checked FactoMineR and SensoMineR packages are loaded and using..

  You still haven't reported the versions of R, the Rcmdr package, and the 
other packages that you're using. The easiest way to do this is to show the 
output of the sessionInfo() command.

  Also, have you tried importing an Excel 

Re: [R] loading the xlsx library

2019-01-14 Thread William Michels via R-help
Hello Bernard,

You might consider using the "readxl" package, which (from the package
description), "Works on Windows, Mac and Linux without external
dependencies."

 https://CRAN.R-project.org/package=readxl

HTH, Bill.

William Michels, Ph.D.

__
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] importing data error question

2019-01-14 Thread Fox, John
Dear jihee,

> On Jan 13, 2019, at 9:28 PM, 우지희  wrote:
> 
>  
>  
> From: "우지희" 
> Sent: Monday, January 14, 2019 9:40:26 AM
> To:"Fox, John" 
> Subject:Re: [R] importing data error question
>  
>  
> Thanks for your replies.
>  
> I'm using windows 7, I loaded FactoMineR,

You said previously that you were using a Mac, so I'm surprised that you now 
say that you're using Windows. I don't have a Windows 7 system, but I can 
confirm that importing from Excel files works perfectly fine under Windows 10, 
as I just verified, and I'd be surprised if the Windows version matters.

> SensoMineR and then Rcmdr. (Downloaded FacroMineR, SensoMineR, Rcmdr, 
> Rcmdrplugin.FactomineR, Rcmdrplugin.SensomineR and other required packages 
> that downloaded automatically)
> This problem occurred when I select Data > Import data > From Excel file.
> I checked FactoMineR and SensoMineR packages are loaded and using..

You still haven't reported the versions of R, the Rcmdr package, and the other 
packages that you're using. The easiest way to do this is to show the output of 
the sessionInfo() command.

Also, have you tried importing an Excel file in the Rcmdr *without* the two 
plug-in packages loaded, as I suggested in my original response? 

It occurs to me that the problem may be produced by using the Rcmdr under R 
with a non-Latin set, but if that were the case I would have expected the 
problem to have surfaced earlier. Did you try reading another kind of file, 
such as a plain-text data file?

Best,
 John

>  
>  
>  
> From: "Fox, John" 
> Sent: Friday, January 11, 2019 10:48:38 PM
> To:"PIKAL Petr" 
> Cc:"우지희" ; "r-help@R-project.org" 
> Subject:Re: [R] importing data error question
>  
>  
> Dear Petr and jihee,
> 
> The Rcmdr can import Excel files, and as I just verified, it can do so on a 
> Mac listing files of all types (*) in the open-file dialog box (which is the 
> default). 
> 
> So, as Petr suggests, more information is required to help you, including the 
> versions of macOS, R, and all packages you have loaded. In particular, does 
> the problem occur when you try to read the Excel file *without* FactoMineR 
> and SensoMineR loaded? Also, when the does problem occur -- immediately when 
> you select Data > Import data > From Excel file, or at some other point?
> 
> Best,
> John
> 
> -
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> Web: http::/socserv.mcmaster.ca/jfox
> 
> > On Jan 11, 2019, at 5:07 AM, PIKAL Petr  wrote:
> > 
> > Hi
> > 
> > I do not use Rcmdr but from documentation it seems to me that it does not 
> > have much to do with importing data from Excel.
> > 
> > So without some additional info from your side (at least used commands) you 
> > hardly get any reasonable answer.
> > 
> > Cheers
> > Petr
> > 
> >> -Original Message-
> >> From: R-help  On Behalf Of ???
> >> Sent: Friday, January 11, 2019 9:14 AM
> >> To: r-help@R-project.org
> >> Subject: [R] importing data error question
> >> 
> >> Hi I'm jihee and I have a question about error...
> >> 
> >> I'm using R 3.5.2 and tried to use Rcmdr package.
> >> 
> >> and using FactoMineR and SensoMineR to analyze sensory data through PCA
> >> 
> >> but i can't import excel data with Rcmdr.
> >> 
> >> it has this messege :
> >> 
> >> Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
> >> [tcl] bad Macintosh file type "“*”"
> >> 
> >> what is wrong with my R??? T_T
> >> 
> >> Thanks for your help.
> >> 
> >> jihee.
> >> [[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.
> > Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
> > partnerů PRECHEZA a.s. jsou zveřejněny na: 
> > https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
> > processing and protection of business partner’s personal data are available 
> > on website: https://www.precheza.cz/en/personal-data-protection-principles/
> > Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné 
> > a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 
> > https://www.precheza.cz/01-dovetek/ | This email and any documents attached 
> > to it may be confidential and are subject to the legally binding 
> > disclaimer: https://www.precheza.cz/en/01-disclaimer/
> > 
> > __
> > 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] CRAN package NlcOptim query

2019-01-14 Thread aveek via R-help
Hi Eric,
Yes, in fact I did mention in my 1st email that I am posting this here as the 
package maintainer did not respond even after a couple of emails.
Thanks,Aveek

Sent from Yahoo Mail on Android 
 
  On Mon, Jan 14, 2019 at 2:11 PM, Eric Berger wrote:   
Aveek,Did you try contacting the package maintainer as Hans suggested?


On Mon, Jan 14, 2019 at 10:31 AM aveek  wrote:

Hello,
Can anyone plz help with the below problem? 
Thanks,Aveek

Sent from Yahoo Mail on Android 
 
  On Wed, Dec 12, 2018 at 12:14 PM, aveek wrote:   
Hello Eric,

Thanks for your response and suggestions. 

I have used dput() on the R objects - sharing below so that it is possible for 
anyone to recreate the situation.

I have still kept it as a 9*9 matrix but for simplicity we now only have 2 
equality and 2 non equality constraints.

Thanks again for your help.

InputTM


structure(c(0.813231189406663, 0.0199464964676128, 0.00100552815128915,

0.000465771436428336, 0.000736922016196076, 0.00203037431732662,

0.000596998285890709, 0.0011699714577823, 0, 0.103116692172408,

0.751775368068589, 0.0160957427707042, 0.00285542569941823, 0.0020295541916448,

0.00954562743564027, 0.00173399818906894, 0.00292299139663608,

0, 0.0481959576543631, 0.177032393868544, 0.811609524051149,

0.146703962329218, 0.0698423269415636, 0.168241524872922, 0.0505757280338206,

0.0324917017565673, 0, 0.026504623193874, 0.038430496838613,

0.134709744786799, 0.758322716164413, 0.176013939161559, 0.234265359508999,

0.108188555487004, 0.0476663548325017, 0, 0.00520614395937929,

0.00868690292550468, 0.0223895752360805, 0.0581458712447338,

0.681496895121054, 0.0733970775224908, 0.0508491985259732, 0.0268876385360338,

0, 0.000749001395622802, 0.00181690494827145, 0.00317194515883476,

0.00705434604769267, 0.0211989316284324, 0.464732208379131, 0.0165146818291576,

0.00721872506710652, 0, 0.000960493069403903, 0.00138444384054219,

0.00703528202498607, 0.0163983255053438, 0.0301780379843763,

0.0280699612529658, 0.491157627745315, 0.0235353949469527, 0,

0.00112628575287418, 0.000477300396419488, 0.00223238360574478,

0.00521558462566306, 0.00925149338117537, 0.00878272484051914,

0.163654071683595, 0.611806567272906, 0, 0.000909613395411595,

0.000449692645903539, 0.00175027421441265, 0.00483799694708872,

0.00925189957399783, 0.0109351418700064, 0.116729140220175, 0.246300654733514,

1), .Dim = c(9L, 9L))

 

 

Constr_new

structure(c(1, 0, -1, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), .Dim = c(2L,

81L), .Dimnames = list(NULL, c("X11", "X12", "X13", "X14", "X15",

"X16", "X17", "X18", "X19", "X21", "X22", "X23", "X24", "X25",

"X26", "X27", "X28", "X29", "X31", "X32", "X33", "X34", "X35",

"X36", "X37", "X38", "X39", "X41", "X42", "X43", "X44", "X45",

"X46", "X47", "X48", "X49", "X51", "X52", "X53", "X54", "X55",

"X56", "X57", "X58", "X59", "X61", "X62", "X63", "X64", "X65",

"X66", "X67", "X68", "X69", "X71", "X72", "X73", "X74", "X75",

"X76", "X77", "X78", "X79", "X81", "X82", "X83", "X84", "X85",

"X86", "X87", "X88", "X89", "X91", "X92", "X93", "X94", "X95",

"X96", "X97", "X98", "X99")))

 

 

x_than0

c(1e-04, 1e-04)

 

aeq2

structure(list(X1 = c(1, 0), X2 = c(1, 0), X3 = c(1, 0), X4 = c(1,

0), X5 = c(1, 0), X6 = c(1, 0), X7 = c(1, 0), X8 = c(1, 0), X9 = c(1,

0), X10 = c(0, 1), X11 = c(0, 1), X12 = c(0, 1), X13 = c(0, 1

), X14 = c(0, 1), X15 = c(0, 1), X16 = c(0, 1), X17 = c(0, 1),

X18 = c(0, 1), X19 = c(0, 0), X20 = c(0, 0), X21 = c(0, 0

    ), X22 = c(0, 0), X23 = c(0, 0), X24 = c(0, 0), X25 = c(0,

0), X26 = c(0, 0), X27 = c(0, 0), X28 = c(0, 0), X29 = c(0,

0), X30 = c(0, 0), X31 = c(0, 0), X32 = c(0, 0), X33 = c(0,

0), X34 = c(0, 0), X35 = c(0, 0), X36 = c(0, 0), X37 = c(0,

0), X38 = c(0, 0), X39 = c(0, 0), X40 = c(0, 0), X41 = c(0,

0), X42 = c(0, 0), X43 = c(0, 0), X44 = c(0, 0), X45 = c(0,

0), X46 = c(0, 0), X47 = c(0, 0), X48 = c(0, 0), X49 = c(0,

0), X50 = c(0, 0), X51 = c(0, 0), X52 = c(0, 0), X53 = c(0,

0), X54 = c(0, 0), X55 = c(0, 0), X56 = c(0, 0), X57 = c(0,

0), X58 = c(0, 0), X59 = c(0, 0), X60 = c(0, 0), X61 = c(0,

0), X62 = c(0, 0), X63 = c(0, 0), X64 = c(0, 0), X65 = c(0,

0), X66 = c(0, 0), X67 = c(0, 0), X68 = c(0, 0), X69 = c(0,

0), X70 = c(0, 0), X71 = c(0, 0), X72 = c(0, 0), X73 = c(0,

0), X74 = c(0, 0), X75 = c(0, 0), X76 = c(0, 0), X77 = c(0,

0), X78 = c(0, 0), X79 = c(0, 0), X80 = c(0, 0), X81 = c(0,

0)), .Names = c("X1", "X2", "X3", "X4", "X5", "X6", "X7",

"X8", "X9", "X10", "X11", "X12", "X13", 

Re: [R] CRAN package NlcOptim query

2019-01-14 Thread aveek via R-help
Hello,
Can anyone plz help with the below problem? 
Thanks,Aveek

Sent from Yahoo Mail on Android 
 
  On Wed, Dec 12, 2018 at 12:14 PM, aveek wrote:   
Hello Eric,

Thanks for your response and suggestions. 

I have used dput() on the R objects - sharing below so that it is possible for 
anyone to recreate the situation.

I have still kept it as a 9*9 matrix but for simplicity we now only have 2 
equality and 2 non equality constraints.

Thanks again for your help.

InputTM


structure(c(0.813231189406663, 0.0199464964676128, 0.00100552815128915,

0.000465771436428336, 0.000736922016196076, 0.00203037431732662,

0.000596998285890709, 0.0011699714577823, 0, 0.103116692172408,

0.751775368068589, 0.0160957427707042, 0.00285542569941823, 0.0020295541916448,

0.00954562743564027, 0.00173399818906894, 0.00292299139663608,

0, 0.0481959576543631, 0.177032393868544, 0.811609524051149,

0.146703962329218, 0.0698423269415636, 0.168241524872922, 0.0505757280338206,

0.0324917017565673, 0, 0.026504623193874, 0.038430496838613,

0.134709744786799, 0.758322716164413, 0.176013939161559, 0.234265359508999,

0.108188555487004, 0.0476663548325017, 0, 0.00520614395937929,

0.00868690292550468, 0.0223895752360805, 0.0581458712447338,

0.681496895121054, 0.0733970775224908, 0.0508491985259732, 0.0268876385360338,

0, 0.000749001395622802, 0.00181690494827145, 0.00317194515883476,

0.00705434604769267, 0.0211989316284324, 0.464732208379131, 0.0165146818291576,

0.00721872506710652, 0, 0.000960493069403903, 0.00138444384054219,

0.00703528202498607, 0.0163983255053438, 0.0301780379843763,

0.0280699612529658, 0.491157627745315, 0.0235353949469527, 0,

0.00112628575287418, 0.000477300396419488, 0.00223238360574478,

0.00521558462566306, 0.00925149338117537, 0.00878272484051914,

0.163654071683595, 0.611806567272906, 0, 0.000909613395411595,

0.000449692645903539, 0.00175027421441265, 0.00483799694708872,

0.00925189957399783, 0.0109351418700064, 0.116729140220175, 0.246300654733514,

1), .Dim = c(9L, 9L))

 

 

Constr_new

structure(c(1, 0, -1, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), .Dim = c(2L,

81L), .Dimnames = list(NULL, c("X11", "X12", "X13", "X14", "X15",

"X16", "X17", "X18", "X19", "X21", "X22", "X23", "X24", "X25",

"X26", "X27", "X28", "X29", "X31", "X32", "X33", "X34", "X35",

"X36", "X37", "X38", "X39", "X41", "X42", "X43", "X44", "X45",

"X46", "X47", "X48", "X49", "X51", "X52", "X53", "X54", "X55",

"X56", "X57", "X58", "X59", "X61", "X62", "X63", "X64", "X65",

"X66", "X67", "X68", "X69", "X71", "X72", "X73", "X74", "X75",

"X76", "X77", "X78", "X79", "X81", "X82", "X83", "X84", "X85",

"X86", "X87", "X88", "X89", "X91", "X92", "X93", "X94", "X95",

"X96", "X97", "X98", "X99")))

 

 

x_than0

c(1e-04, 1e-04)

 

aeq2

structure(list(X1 = c(1, 0), X2 = c(1, 0), X3 = c(1, 0), X4 = c(1,

0), X5 = c(1, 0), X6 = c(1, 0), X7 = c(1, 0), X8 = c(1, 0), X9 = c(1,

0), X10 = c(0, 1), X11 = c(0, 1), X12 = c(0, 1), X13 = c(0, 1

), X14 = c(0, 1), X15 = c(0, 1), X16 = c(0, 1), X17 = c(0, 1),

X18 = c(0, 1), X19 = c(0, 0), X20 = c(0, 0), X21 = c(0, 0

    ), X22 = c(0, 0), X23 = c(0, 0), X24 = c(0, 0), X25 = c(0,

0), X26 = c(0, 0), X27 = c(0, 0), X28 = c(0, 0), X29 = c(0,

0), X30 = c(0, 0), X31 = c(0, 0), X32 = c(0, 0), X33 = c(0,

0), X34 = c(0, 0), X35 = c(0, 0), X36 = c(0, 0), X37 = c(0,

0), X38 = c(0, 0), X39 = c(0, 0), X40 = c(0, 0), X41 = c(0,

0), X42 = c(0, 0), X43 = c(0, 0), X44 = c(0, 0), X45 = c(0,

0), X46 = c(0, 0), X47 = c(0, 0), X48 = c(0, 0), X49 = c(0,

0), X50 = c(0, 0), X51 = c(0, 0), X52 = c(0, 0), X53 = c(0,

0), X54 = c(0, 0), X55 = c(0, 0), X56 = c(0, 0), X57 = c(0,

0), X58 = c(0, 0), X59 = c(0, 0), X60 = c(0, 0), X61 = c(0,

0), X62 = c(0, 0), X63 = c(0, 0), X64 = c(0, 0), X65 = c(0,

0), X66 = c(0, 0), X67 = c(0, 0), X68 = c(0, 0), X69 = c(0,

0), X70 = c(0, 0), X71 = c(0, 0), X72 = c(0, 0), X73 = c(0,

0), X74 = c(0, 0), X75 = c(0, 0), X76 = c(0, 0), X77 = c(0,

0), X78 = c(0, 0), X79 = c(0, 0), X80 = c(0, 0), X81 = c(0,

0)), .Names = c("X1", "X2", "X3", "X4", "X5", "X6", "X7",

"X8", "X9", "X10", "X11", "X12", "X13", "X14", "X15", "X16",

"X17", "X18", "X19", "X20", "X21", "X22", "X23", "X24", "X25",

"X26", "X27", "X28", "X29", "X30", "X31", "X32", "X33", "X34",

"X35", "X36", "X37", "X38", "X39", "X40", "X41", "X42", "X43",

"X44", "X45", "X46", "X47", "X48", "X49", "X50", "X51", "X52",

"X53", "X54", "X55", "X56", "X57", "X58", "X59", "X60", "X61",

"X62", "X63", "X64", "X65", "X66", 

Re: [R-es] Cómo replicar unos clusters según sistema anterior.

2019-01-14 Thread Juan Abasolo
Muchas gracias, Isidro;
Hice la prueba que me recomendás y con mis datos me da los mismos clusters.
La única diferencia que aprecio es el orden estético. Pero las agrupaciones
que me surgen son idénticas a hclust(x, method = 'ward.D2').
Si se te ocurre algún otro más, bienvenido será.

Juan

Hau idatzi du Isidro Hidalgo Arellano (ihida...@jccm.es) erabiltzaileak
(2019 urt. 14, al. (07:48)):

> ¿Has probado la versión de la función "agnes"?:
> https://www.rdocumentation.org/packages/cluster/versions/1.4-1/topics/agnes
> Por lo que parece, utiliza el mismo método que la antigua "hclust", que
> debería ser el mismo que la opción "method = "Ward.D2". Por probar no
> pierdes nada...
> Un saludo
>
> Isidro Hidalgo Arellano
> Observatorio del Mercado de Trabajo
> Consejería de Economía, Empresas y Empleo
> http://www.castillalamancha.es/
>
>
> -Mensaje original-
> De: R-help-es  En nombre de Juan Abasolo
> Enviado el: sábado, 12 de enero de 2019 19:45
> Para: R-help-es 
> Asunto: [R-es] Cómo replicar unos clusters según sistema anterior.
>
> Buenas noches;
> vengo con una consulta, que no se si es fácilmente resoluble o necesito
> saber más para entender porqué no tengo que hacer lo que me propongo.
>
> Tengo una matriz de distancias y unos clusters según metodo "ward" que me
> los da una web construida hace ya unos años. Supongo que fue publicada en
> el
> 2012, por lo que estará construida en el 11, 10 o antes).
>
> Esta web me devuelve unas agrupaciones (el gráfico) o me permite a mí bajar
> la matriz de distancias.
>
> Bajé la matriz de distancias y pretendí replicar los resultados
> > plot(hclust(matriz.bajada, method = 'ward.D2')
> pero no se replicó, sino que salieron otros clusters.
> También probé con ward.D. No consigo los resultados de la web.
>
> La matriz de datos, insisto, es la que usa la web en custión. Por lo que no
> debería ser tan difícil replicar los resultados.
>
> Tengo entendido que en algún momento el "standard" de cómo calcular los
> clusters según ward en R cambió.
>
> Pregunta: **¿Cómo podría rehacer con los metodos anteriores?** Acá hay
> espacio para las cábalas.
> O **por qué no hacerlo?**
>
> Muchas gracias
>
>
> --
> Juan Abasolo
>
> Hizkuntzaren eta Literaturaren Didaktika Saila | EUDIA ikerketa taldea
> Bilboko Hezkuntza Fakultatea Euskal Herriko Unibertsitatea UPV/EHU
>
> Sarriena auzoa z/g 48940 - Leioa (Bizkaia)
>
> T: (+34) 94 601 7567
> Telegram: @JuanAbasolo
> Skype: abasolo72
>
> Tutoretza ordutegia 
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
>

-- 
Juan Abasolo

Hizkuntzaren eta Literaturaren Didaktika Saila | EUDIA ikerketa taldea
Bilboko Hezkuntza Fakultatea
Euskal Herriko Unibertsitatea
UPV/EHU

Sarriena auzoa z/g 48940 - Leioa (Bizkaia)

T: (+34) 94 601 7567
Telegram: @JuanAbasolo
Skype: abasolo72

Tutoretza ordutegia 

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Extrapolate x values from a defined y sequence

2019-01-14 Thread Eric Berger
Hi Lionel,
Your choice of variable names is a bit odd (the roles of x and y seem to be
reversed from the usual.)
Assuming that you are looking for linear interpolation (in spite of the
subject of your email),
does the following give you what you need?

u1 <- approx(x=y1,y=x1,xout=y)
u2 <- approx(x=y2,y=x2,xout=y)
v   <- u1$y + u2$y

# At this point v is the sequence  x1+x2 and y is as you specified it.
# v
# [1]  2.0  6.0 11.0 16.29167 17.75000 18.41667 18.9
19.47222 20.0
# y
# [1] 5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0

HTH,
Eric



On Mon, Jan 14, 2019 at 2:16 PM lionel sicot via R-help <
r-help@r-project.org> wrote:

> Hello,
> I have two sets of measurement :with the same x sequence
> :x1<-1:10y1<-c(5,4.6,4.4,4.2,4,3.8,3.7,3.6,3,1)
> x2<-1:10y2<-c(5,4.8,4.6,4.4,4.1,4,3.8,3.6,2.8,1)
> I would like to sum these two curves in terms of x for a given sequence of
> y (for example : y<-c(5,4.5,4,3.5,3,2.5,2,1.5,1)), that is to determine for
> each y, an x1' from x1 and an x2' from x2 corresponding to y so that I can
> plot y as a function of (x1'+x2').
> I hope it is clear enough.
> I think I can do it with a loop an some non-conventional R script (I'm not
> a computer scientist) but i'm pretty sure that there is an elegant way to
> do it with R.
> It will be very kind if someone can give me some R functions to do
> it.Thanks in advance,Ptit Bleu.
>
>
>
>
> [[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.
>

[[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] Extrapolate x values from a defined y sequence

2019-01-14 Thread lionel sicot via R-help
Hello,
I have two sets of measurement :with the same x sequence 
:x1<-1:10y1<-c(5,4.6,4.4,4.2,4,3.8,3.7,3.6,3,1)
x2<-1:10y2<-c(5,4.8,4.6,4.4,4.1,4,3.8,3.6,2.8,1)
I would like to sum these two curves in terms of x for a given sequence of y 
(for example : y<-c(5,4.5,4,3.5,3,2.5,2,1.5,1)), that is to determine for each 
y, an x1' from x1 and an x2' from x2 corresponding to y so that I can plot y as 
a function of (x1'+x2').
I hope it is clear enough.
I think I can do it with a loop an some non-conventional R script (I'm not a 
computer scientist) but i'm pretty sure that there is an elegant way to do it 
with R.
It will be very kind if someone can give me some R functions to do it.Thanks in 
advance,Ptit Bleu.




[[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] NA rows appeared in data.frame

2019-01-14 Thread S Ellison
> After replacing some values in a data.frame, NAs rows have appeared
> and cannot be removed. 
I'm not clear why you say 'cannot be removed', which sounds quite a bit 
stronger than 'I couldn't ...'. 
The example you gave returned new NA rows because your logical test included 
NAs (Petal.Width == 2.0 returns NA for all of the NA petal widths, and an NA in 
indexing returns an NA row). 
But 'cannot be removed' sounded to me as if you've read somewhere that it's 
impossible, or that you've tried something that should work and didn't; if you 
meant either of those you'll have to say what the problem was.

In the mean time: 
If you want to remove rows containing _any_ NAs, see ?complete.cases  and use 
something like
t1[complete.cases(t1),]

If you want to remove rows that are _all_ NA, you may need something like

subset(t1, apply(t1, 1, function(x) !all(is.na(x
(or the equivalent '[' usage)

and, as an aside, using '==' for floating point numbers is not generally safe; 
for example
> sqrt(2)^2 == 2.0
[1] FALSE

See R FAQ 7.31 for details of why '==' is bad for floating point, if you 
haven't already.


S Ellison

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ernest Han
> Sent: 12 January 2019 08:23
> To: r-help@r-project.org
> Subject: [R] NA rows appeared in data.frame
> 
> Dear All,
> 
> After replacing some values in a data.frame, NAs rows have appeared
> and cannot be removed. I have googled these issues and found that
> several people have encountered it. Solutions in stackoverflow seem to
> provide work-arounds but does not remove it from the data.frame.
> Therefore, I am turning to experts in this community for help.
> 
> The code is as follows,
> 
> > t1 <- iris
> > t1[t1$Petal.Width==1.8, "Petal.Width"] <- NA
> > t1[t1$Petal.Width == 2.0, ]
>   Sepal.Length Sepal.Width Petal.Length Petal.Width   Species
> NA  NA  NA   NA  NA  
> NA.1NA  NA   NA  NA  
> NA.2NA  NA   NA  NA  
> NA.3NA  NA   NA  NA  
> 1116.5 3.2  5.1   2 virginica
> 1145.7 2.5  5.0   2 virginica
> NA.4NA  NA   NA  NA  
> 1225.6 2.8  4.9   2 virginica
> 1237.7 2.8  6.7   2 virginica
> NA.5NA  NA   NA  NA  
> NA.6NA  NA   NA  NA  
> NA.7NA  NA   NA  NA  
> NA.8NA  NA   NA  NA  
> 1327.9 3.8  6.4   2 virginica
> NA.9NA  NA   NA  NA  
> NA.10   NA  NA   NA  NA  
> 1486.5 3.0  5.2   2 virginica
> NA.11   NA  NA   NA  NA  
> 
> ## Twelve values were replaced, twelve NA rows appeared.
> 
> ### MISC INFO ###
> > sessionInfo()
> R version 3.4.0 (2017-04-21)
> Platform: x86_64-apple-darwin16.5.0 (64-bit)
> Running under: macOS  10.14.2
> 
> Matrix products: default
> BLAS:
> /System/Library/Frameworks/Accelerate.framework/Versions/A/Framewor
> ks/vecLib.framework/Versions/A/libBLAS.dylib
> LAPACK:
> /System/Library/Frameworks/Accelerate.framework/Versions/A/Framewor
> ks/vecLib.framework/Versions/A/libLAPACK.dylib
> 
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> loaded via a namespace (and not attached):
> [1] compiler_3.4.0 tools_3.4.0
> > Sys.getlocale()
> [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-
> 8"
> 
> 
> Thank you,
> Ernest
> 
> __
> 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.


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Tinn-R: new web site

2019-01-14 Thread S Ellison
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jose
> Claudio Faria
> 
> The Tinn-R project has a new web page:
> http://nbcgib.uesc.br/tinnr/en/index.php
> 


Thanks for this - and thanks, also, for maintaining Tinn-R and keeping it 
available as free software. The effort is much appreciated.

Steve Ellison



***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] [R-pkgs] standard errors in depmixS4 beta version 1.4 on r-forge

2019-01-14 Thread Ingmar Visser
The new 1.4 version of depmixS4 has an important (and much requested!) new
feature: the possibility to request standard errors of estimated parameters
through the use of a finite differences approximation of the hessian. As
this is a critical feature we appreciate your comments and feedback when
using the beta version of this package available from r-forge:
https://r-forge.r-project.org/R/?group_id=148
which can be installed using:
*install.packages("depmixS4", repos="http://R-Forge.R-project.org
")*

As soon as enough testing has been done and we are confident about the
robustness of this new functionality we will post the package to CRAN.

Happy mixing, Ingmar Visser & Maarten Speekenbrink

Ingmar Visser
Universitair Hoofddocent ontwikkelingspsychologie | Directeur College
Psychologie
Afdeling Psychologie | Faculteit Maatschappij- en Gedragswetenschappen |
Universiteit van Amsterdam
Bezoek | Nieuwe Achtergracht 129B | Kamer G 1.18
Post | Postbus 15933 | 1001 NK Amsterdam
Pakketpost | Valckenierstraat 59 | 1018 XE Amsterdam
T: +31205256723 | M: +31647260824 | e: i.vis...@uva.nl

[[alternative HTML version deleted]]

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] CRAN package NlcOptim query

2019-01-14 Thread Eric Berger
Aveek,
Did you try contacting the package maintainer as Hans suggested?



On Mon, Jan 14, 2019 at 10:31 AM aveek  wrote:

> Hello,
>
> Can anyone plz help with the below problem?
>
> Thanks,
> Aveek
>
> Sent from Yahoo Mail on Android
> 
>
> On Wed, Dec 12, 2018 at 12:14 PM, aveek
>  wrote:
>
> Hello Eric,
>
> Thanks for your response and suggestions.
>
> I have used dput() on the R objects - sharing below so that it is possible
> for anyone to recreate the situation.
>
> I have still kept it as a 9*9 matrix but for simplicity we now only have 2
> equality and 2 non equality constraints.
>
> Thanks again for your help.
>
> InputTM
>
> structure(c(0.813231189406663, 0.0199464964676128, 0.00100552815128915,
>
> 0.000465771436428336, 0.000736922016196076, 0.00203037431732662,
>
> 0.000596998285890709, 0.0011699714577823, 0, 0.103116692172408,
>
> 0.751775368068589, 0.0160957427707042, 0.00285542569941823,
> 0.0020295541916448,
>
> 0.00954562743564027, 0.00173399818906894, 0.00292299139663608,
>
> 0, 0.0481959576543631, 0.177032393868544, 0.811609524051149,
>
> 0.146703962329218, 0.0698423269415636, 0.168241524872922,
> 0.0505757280338206,
>
> 0.0324917017565673, 0, 0.026504623193874, 0.038430496838613,
>
> 0.134709744786799, 0.758322716164413, 0.176013939161559, 0.234265359508999,
>
> 0.108188555487004, 0.0476663548325017, 0, 0.00520614395937929,
>
> 0.00868690292550468, 0.0223895752360805, 0.0581458712447338,
>
> 0.681496895121054, 0.0733970775224908, 0.0508491985259732,
> 0.0268876385360338,
>
> 0, 0.000749001395622802, 0.00181690494827145, 0.00317194515883476,
>
> 0.00705434604769267, 0.0211989316284324, 0.464732208379131,
> 0.0165146818291576,
>
> 0.00721872506710652, 0, 0.000960493069403903, 0.00138444384054219,
>
> 0.00703528202498607, 0.0163983255053438, 0.0301780379843763,
>
> 0.0280699612529658, 0.491157627745315, 0.0235353949469527, 0,
>
> 0.00112628575287418, 0.000477300396419488, 0.00223238360574478,
>
> 0.00521558462566306, 0.00925149338117537, 0.00878272484051914,
>
> 0.163654071683595, 0.611806567272906, 0, 0.000909613395411595,
>
> 0.000449692645903539, 0.00175027421441265, 0.00483799694708872,
>
> 0.00925189957399783, 0.0109351418700064, 0.116729140220175,
> 0.246300654733514,
>
> 1), .Dim = c(9L, 9L))
>
>
>
>
>
> Constr_new
>
> structure(c(1, 0, -1, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
>
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), .Dim = c(2L,
>
> 81L), .Dimnames = list(NULL, c("X11", "X12", "X13", "X14", "X15",
>
> "X16", "X17", "X18", "X19", "X21", "X22", "X23", "X24", "X25",
>
> "X26", "X27", "X28", "X29", "X31", "X32", "X33", "X34", "X35",
>
> "X36", "X37", "X38", "X39", "X41", "X42", "X43", "X44", "X45",
>
> "X46", "X47", "X48", "X49", "X51", "X52", "X53", "X54", "X55",
>
> "X56", "X57", "X58", "X59", "X61", "X62", "X63", "X64", "X65",
>
> "X66", "X67", "X68", "X69", "X71", "X72", "X73", "X74", "X75",
>
> "X76", "X77", "X78", "X79", "X81", "X82", "X83", "X84", "X85",
>
> "X86", "X87", "X88", "X89", "X91", "X92", "X93", "X94", "X95",
>
> "X96", "X97", "X98", "X99")))
>
>
>
>
>
> x_than0
>
> c(1e-04, 1e-04)
>
>
>
> aeq2
>
> structure(list(X1 = c(1, 0), X2 = c(1, 0), X3 = c(1, 0), X4 = c(1,
>
> 0), X5 = c(1, 0), X6 = c(1, 0), X7 = c(1, 0), X8 = c(1, 0), X9 = c(1,
>
> 0), X10 = c(0, 1), X11 = c(0, 1), X12 = c(0, 1), X13 = c(0, 1
>
> ), X14 = c(0, 1), X15 = c(0, 1), X16 = c(0, 1), X17 = c(0, 1),
>
> X18 = c(0, 1), X19 = c(0, 0), X20 = c(0, 0), X21 = c(0, 0
>
> ), X22 = c(0, 0), X23 = c(0, 0), X24 = c(0, 0), X25 = c(0,
>
> 0), X26 = c(0, 0), X27 = c(0, 0), X28 = c(0, 0), X29 = c(0,
>
> 0), X30 = c(0, 0), X31 = c(0, 0), X32 = c(0, 0), X33 = c(0,
>
> 0), X34 = c(0, 0), X35 = c(0, 0), X36 = c(0, 0), X37 = c(0,
>
> 0), X38 = c(0, 0), X39 = c(0, 0), X40 = c(0, 0), X41 = c(0,
>
> 0), X42 = c(0, 0), X43 = c(0, 0), X44 = c(0, 0), X45 = c(0,
>
> 0), X46 = c(0, 0), X47 = c(0, 0), X48 = c(0, 0), X49 = c(0,
>
> 0), X50 = c(0, 0), X51 = c(0, 0), X52 = c(0, 0), X53 = c(0,
>
> 0), X54 = c(0, 0), X55 = c(0, 0), X56 = c(0, 0), X57 = c(0,
>
> 0), X58 = c(0, 0), X59 = c(0, 0), X60 = c(0, 0), X61 = c(0,
>
> 0), X62 = c(0, 0), X63 = c(0, 0), X64 = c(0, 0), X65 = c(0,
>
> 0), X66 = c(0, 0), X67 = c(0, 0), X68 = c(0, 0), X69 = c(0,
>
> 0), X70 = c(0, 0), X71 = c(0, 0), X72 = c(0, 0), X73 = c(0,
>
> 0), X74 = c(0, 0), X75 = c(0, 0), X76 = c(0, 0), X77 = c(0,
>
> 0), X78 = c(0, 

Re: [R] NA rows appeared in data.frame

2019-01-14 Thread PIKAL Petr
Hi

If you want to remove rows with NA values from your data you could use

?complete.cases

or

t2 <- t1[!is.na(t1$Petal.Width),]

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of Rui Barradas
> Sent: Saturday, January 12, 2019 12:55 PM
> To: Ernest Han ; r-help@r-project.org
> Subject: Re: [R] NA rows appeared in data.frame
>
> Hello,
>
> You have to test for NA. Some (12) of the values of t1$Petal.Width are NA
> therefore t1$Petal.Width == 2.0 alone returns 12 NA values.
>
> t1[t1$Petal.Width == 2.0 & !is.na(t1$Petal.Width == 2.0), ]
>
> Or use which(t1$Petal.Width == 2.0).
>
> t1[which(t1$Petal.Width == 2.0), ]
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 08:23 de 12/01/2019, Ernest Han escreveu:
> > Dear All,
> >
> > After replacing some values in a data.frame, NAs rows have appeared
> > and cannot be removed. I have googled these issues and found that
> > several people have encountered it. Solutions in stackoverflow seem to
> > provide work-arounds but does not remove it from the data.frame.
> > Therefore, I am turning to experts in this community for help.
> >
> > The code is as follows,
> >
> >> t1 <- iris
> >> t1[t1$Petal.Width==1.8, "Petal.Width"] <- NA t1[t1$Petal.Width ==
> >> 2.0, ]
> >Sepal.Length Sepal.Width Petal.Length Petal.Width   Species
> > NA  NA  NA   NA  NA  
> > NA.1NA  NA   NA  NA  
> > NA.2NA  NA   NA  NA  
> > NA.3NA  NA   NA  NA  
> > 1116.5 3.2  5.1   2 virginica
> > 1145.7 2.5  5.0   2 virginica
> > NA.4NA  NA   NA  NA  
> > 1225.6 2.8  4.9   2 virginica
> > 1237.7 2.8  6.7   2 virginica
> > NA.5NA  NA   NA  NA  
> > NA.6NA  NA   NA  NA  
> > NA.7NA  NA   NA  NA  
> > NA.8NA  NA   NA  NA  
> > 1327.9 3.8  6.4   2 virginica
> > NA.9NA  NA   NA  NA  
> > NA.10   NA  NA   NA  NA  
> > 1486.5 3.0  5.2   2 virginica
> > NA.11   NA  NA   NA  NA  
> >
> > ## Twelve values were replaced, twelve NA rows appeared.
> >
> > ### MISC INFO ###
> >> sessionInfo()
> > R version 3.4.0 (2017-04-21)
> > Platform: x86_64-apple-darwin16.5.0 (64-bit) Running under: macOS
> > 10.14.2
> >
> > Matrix products: default
> > BLAS:
> > /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/
> > vecLib.framework/Versions/A/libBLAS.dylib
> > LAPACK:
> > /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/
> > vecLib.framework/Versions/A/libLAPACK.dylib
> >
> > locale:
> > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> >
> > attached base packages:
> > [1] stats graphics  grDevices utils datasets  methods   base
> >
> > loaded via a namespace (and not attached):
> > [1] compiler_3.4.0 tools_3.4.0
> >> Sys.getlocale()
> > [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8"
> >
> >
> > Thank you,
> > Ernest
> >
> > __
> > 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-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.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a 
podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 
https://www.precheza.cz/01-dovetek/ | This email and any documents attached to 
it may be confidential and are subject to the legally binding disclaimer: 
https://www.precheza.cz/en/01-disclaimer/

__
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