[R] how to stop interpretation in system()

2016-07-21 Thread Michael Peng
Hi, I am trying to use system() to run some command in OS. such as system("cmd 'a\tb') however, it alway runs cmd 'ab' instead of cmd 'a\tb' How can I prevent system to interpret 'a\tb' to 'ab'? Thanks [[alternative HTML version deleted]] ___

Re: [R] how to stop interpretation in system()

2016-07-21 Thread Michael Peng
Yes. I forgot to escape the escape. Thank you so much. 2016-07-21 16:07 GMT-04:00 Sarah Goslee : > You could escape the backslash. > > system("cmd 'a\\tb'") > > > On Thu, Jul 21, 2016 at 4:00 PM, Michael Peng > wrote: > > Hi, > > > >

[R] Error when install R package in Windows

2014-11-10 Thread Michael Peng
Dear all, I am now writing a R library. After I build it in Windows *R CMD INSTALL --build --compile-both foo.tar.gz*, I get a file foo.zip. foo.tar.gz is the source file tarball. When I tried to install the package in R ( *install.packages("foo.zip")*, or choose the zip file from menu package/ins

[R] Cannot change R package name in Windows and cannot install an R package in Mac OS Yosemite

2014-11-11 Thread Michael Peng
Hi, I am now writing an R package LFSpro. I build it for both Mac OS and Windows. For Windows, the binary package name is LFSpro_1.0.3.zip. It can be installed into R successfully. But when I changed the name to LFSpro_1.0.3.Windows.zip, an error occurred: Error in read.dcf(file.path(pkgname,"DE

Re: [R] Cannot change R package name in Windows and cannot install an R package in Mac OS Yosemite

2014-11-11 Thread Michael Peng
I see. Thanks a lot. Gang On Tuesday, November 11, 2014, Uwe Ligges wrote: > > > On 11.11.2014 23:05, Michael Peng wrote: > >> Hi, >> >> I am now writing an R package LFSpro. I build it for both Mac OS and >> Windows. >> >> For Windows, the bi

Re: [R] ts time-object indexing question?

2016-02-15 Thread Michael Peng
a.ts[time(a.ts)==1965] 2016-02-15 10:53 GMT-05:00 ce : > > Dear all, > > I can't find an answer to this simple question: > > a.ts <- ts(1:10, frequency = 1, start = c(1959, 1)) > > a.ts > Time Series: > Start = 1959 > End = 1968 > Frequency = 1 > [1] 1 2 3 4 5 6 7 8 9 10 > > Now I wan

[R] How to avoid endless loop in shiny

2016-03-08 Thread Michael Peng
Hi, I added two sliderInput into the app with package "shiny": sliderA and sliderB. The values in the two sliders are correlated. If I change sliderA, I used updateSliderInput to update the value in sliderB. And also If I change sliderB, I used updateSliderInput to update the value in slideA. Th

Re: [R] How to avoid endless loop in shiny

2016-03-10 Thread Michael Peng
value=isolate(ifelse(input$r<0,-1,1))*sqrt(input$r2)) > }) > > observe({ > updateSliderInput(session, 'r2', value=input$r^2) > }) > > > I did end up in a loop once when I happened to choose just the wrong > value and the rounding caused a jumping bac

Re: [R] How to avoid searching variables in global environment

2013-09-12 Thread Michael Peng
I see. Thanks a lot for your help. M. 2013/9/12 Bert Gunter > No No! The parent environment is **not necessarily** the enclosing > environment. The difference is crucial. R looks for free variables in the > enclosing, **not** the parent environment (although they are often the > same). Please

Re: [R] How to avoid searching variables in global environment

2013-09-12 Thread Michael Peng
I thought '+' was defined in a more basic level. I usually use CPP. R is very different from CPP in many basic concepts. M. 2013/9/12 William Dunlap > Typo: in > environment(fun) <- new.env(parent=parent.env()) > the parent.env() should have been emptyenv(). But, as > I said, you do not w

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread Michael Peng
David gave a great solution. I think it is better to start from 0 to min(M) instead of from min(M[c(1,3)]) to avoid negative values in the table. If the minimum is in M[1] or M[3], a = 1:min(M). Otherwise, d=1:min(M). Best, Gang 2014-06-24 13:18 GMT-05:00 David L Carlson : > Since a 2x2 table w

Re: [R] saving a 'get' object in R

2014-06-24 Thread Michael Peng
You can use the following command: tmp <- get(foo) save(tmp,file=paste(foo,'.rData',sep='')) Best, Mike 2014-06-24 15:35 GMT-05:00 David Stevens : > R community, > > Apologies if this has been answered. The concept I'm looking for is to > save() an object retrieved using get() for an object >

Re: [R] merge question

2014-06-29 Thread Michael Peng
you can get a new data frame by merge(qpiso, qplegit, all.x = TRUE, all.y = TRUE, by = "iso" ) Take the subtraction on the new data frame. 2014-06-29 11:24 GMT-05:00 Dr Eberhard Lisse : > I have two data frames like so > > > qpiso > iso requests > 1A1 20 > 2A2 199 > 3

Re: [R] Analysis using repeated measure mixed effect anova

2014-06-29 Thread Michael Peng
For the t-test, you used the two-tailed t-test. It is the default. Here I think you should set alternative="less" in the t.test function. 2014-06-29 8:41 GMT-05:00 dhs : > Trying to understand how to analyze my data, sample data follows. I want > to know if the student scores increased from sem

Re: [R] x axis labelling

2014-07-01 Thread Michael Peng
Did you add xaxt = "n" in the plot function? Try the following: plot(x,y, xaxt = "n") axis(1, at = c(14, 20),labels = c("14h", "20h") ) 2014-07-01 12:41 GMT-05:00 Michael Millar : > Hi, > > I am new to R and am trying to create a graph with Time(24hr) along the x > axis. Rather than start at 01