Re: [R] In Ops.factor(...) not meaningful for factors

2017-08-27 Thread PIKAL Petr
Hi see in line > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of ? > ??? > Sent: Sunday, August 27, 2017 7:53 PM > To: r-help > Subject: [R] In Ops.factor(...) not meaningful for factors > > Good evening! > I don't know R, but I have to d

Re: [R] help with read.csv() for files with different number of columns

2017-08-27 Thread Fix Ace via R-help
Hi, Jim, Thank you very much for pointing out the format issue. Here is the original text: ===I have a text file (test.txt) with different number of columns: 0610007P14Rik%%% Tcf19 Gtf2i 0610010O12Rik%%% Ivns1abp Etv6 111G20Rik%%% Nmi 1500015O10Rik%%% Foxi1 Ascl3 Sirt3 173E16Rik%%% Ascl2

Re: [R] regex - optional part isn't considered in replacement with gsub

2017-08-27 Thread Jeff Newmiller
Omar, please remember that this is R-help, not R-do-my-work-for-me... you have already been given several hints as to how you can refine your patterns yourself. These skills are key to real world data science, so you need to work at being able to take hints and expand on them if you are to be s

Re: [R] regex - optional part isn't considered in replacement with gsub

2017-08-27 Thread Bert Gunter
"Please, consider that some SKUs have "-" in the middle, for example: "PG-9021". Then you need to include these in the list of patterns you gave. Try it again -- this time with a **complete** list. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and

Re: [R] help with read.csv() for files with different number of columns

2017-08-27 Thread Jim Lemon
Hi Ace, With tabs as separators: testdf<-read.table("test.txt",header=FALSE,fill=TRUE,sep="\t", col.names=paste("V",1:19,sep=""),stringsAsFactors=FALSE) Also note that I got the number of columns wrong the first time. Jim On Mon, Aug 28, 2017 at 12:56 PM, Fix Ace wrote: > Hi, Jim, > > Thank y

Re: [R] help with read.csv() for files with different number of columns

2017-08-27 Thread Jim Lemon
Hi Ace, As your example seems to have spaces as separators, testdf<-read.table("test.txt",header=FALSE,fill=TRUE, col.names=paste("V",1:14,sep=""),stringsAsFactors=FALSE) By specifying the number of columns with "col.names" and using "fill=TRUE" you can get a data frame with zero length strings w

Re: [R] help with read.csv() for files with different number of columns

2017-08-27 Thread Bert Gunter
Email a mess. Too hard for me to decipher, maybe also for others. If no response, send plain text, as requested by posting guide. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his

Re: [R] regex - optional part isn't considered in replacement with gsub

2017-08-27 Thread Bert Gunter
Omar: I don't think this can work. For example number-letter patterns 4), 5), and 6) would all be matched by pattern 6). As Jeff indicated, you need to provide the delimiters -- what characters come before and after the SKU patterns -- to be able to recognize them. In a quick look at the text fil

[R] help with read.csv() for files with different number of columns

2017-08-27 Thread Fix Ace via R-help
Dear R community, I have a text file (test.txt) with different number of columns: 0610007P14Rik%%% Tcf19 Gtf2i 0610010O12Rik%%% Ivns1abp Etv6 111G20Rik%%% Nmi 1500015O10Rik%%% Foxi1 Ascl3 Sirt3 173E16Rik%%% Ascl2 Ifnar2 1700028J19Rik%%% Musk Nfe2l3 1810011O10Rik%%% Ppp1r13b Bpnt1 Cdkn2c F

[R] In Ops.factor(...) not meaningful for factors

2017-08-27 Thread Александр Мащенко
Good evening! I don't know R, but I have to do this work for my diploma. So I'm sorry for the strange message below. Help me anybody decides this issues, please. a part of the code is: for (i in 1:133) { r_squared <- vector() sample_bank <- mydata[((i-1)*311+1):(i*311),] #return for bank retur

Re: [R] Fwd: Find maxima of a function

2017-08-27 Thread Bert Gunter
Just a quick note: "I have tried to use optimr but it gives me the local maxima, now I am struck with the problem of how to get the global maxima" This is a profound misunderstanding of how numerical optimization works. **All** numerical optimizers can provide only "local" maxima (the exact meani

Re: [R] Difficulty Installing Packages

2017-08-27 Thread Richard M. Heiberger
And also to the initial error message I suggest the message be revised to say " unable to move temporary installation. Please close all running R instances, and try again from a fresh 'R --vanilla' instance" On Sun, Aug 27, 2017 at 1:41 PM, Jeff Newmiller wrote: > I think that this response s

Re: [R] Difficulty Installing Packages

2017-08-27 Thread Jeff Newmiller
I think that this response should be added to R for Windows FAQ 3.5. -- Sent from my phone. Please excuse my brevity. On August 26, 2017 11:45:55 PM PDT, Uwe Ligges wrote: >On Windows, if you load a dll, this is locked. >Hence, for package installations, close all R instances, start one >witho

Re: [R] regex - optional part isn't considered in replacement with gsub

2017-08-27 Thread Bert Gunter
You may have to provide us more detail on **exactly** the sorts of patterns you wish to "capture" -- including exactly what you mean by "capture" (what vaue do you wish to return?) -- as the "obvious" answer is probably not sufficient: ## using your example -- thankyou > gsub(".*(49MU6300|LE32S59

Re: [R] regex - optional part isn't considered in replacement with gsub

2017-08-27 Thread Jeff Newmiller
Clearly you are being too specific about the structure of the sku. In the absence of better information about the sku you need to focus on identifying the delimiters and position of the sku... one way might be: ecommerce$sku <- sub( "^(.*)[ \n]+([^ \n]+)$", "\\2", ecommerce$producto ) Please l

[R] regex - optional part isn't considered in replacement with gsub

2017-08-27 Thread Omar André Gonzáles Díaz
Hello, I need some help with regex. I have this to sentences. I need to extract both "49MU6300" and "LE32S5970" and put them in a new colum "SKU". A) SMART TV UHD 49'' CURVO 49MU6300 B) SMART TV HD 32'' LE32S5970 DataFrame for testing: ecommerce <- data.frame(a = c(1,2), producto = c("SMART TV

Re: [R] Fwd: Find maxima of a function

2017-08-27 Thread Ranjan Maitra
I have not followed the history of this thread, but I am quite flummoxed as to why the OP is rewriting code to estimate parameters from an univariate Gaussian mixture model when alternatives such as EMCluster (which generally appears to handle initialization better than MClust) exist. Or perhaps

Re: [R] Fwd: Find maxima of a function

2017-08-27 Thread Ismail SEZEN
Dear Niharika, As I said before, the problem is basically an optimization issue. You should isolate the problematic part from the rest of your study. Sometimes, more information does not help to solution. All the answers from us (Ulrik, David, me) are more or less are correct to find a maximum

[R] Fwd: Find maxima of a function

2017-08-27 Thread niharika singhal
-- Forwarded message -- From: niharika singhal Date: Sun, Aug 27, 2017 at 11:57 AM Subject: Re: Find maxima of a function To: "David Winsemius [via R]" , "Ismail SEZEN [via R]" , Ulrik Stervbo Dear David and Ismail, The actual problem is I am getting the parameters from the Kme