Re: [R] Grep command

2016-05-19 Thread Joyce Robbins
I'm not sure you need grep:

> all %in% some
[1]  TRUE FALSE  TRUE FALSE FALSE  TRUE

On Thu, May 19, 2016 at 7:58 PM, MacQueen, Don  wrote:

> Start with:
>
> > all <- c("ants","birds","cats","dogs","elks","fox")
> > all[grep('ants|cats|fox',all)]
> [1] "ants" "cats" "fox"
>
> Then construct the first arg to grep:
>
> > some <- c("ants","cats","fox")
> > all[ grep( paste(some,collapse='|') , all)]
> [1] "ants" "cats" "fox"
>
>
>
> --
> Don MacQueen
>
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
>
>
>
>
>
> On 5/19/16, 4:09 PM, "R-help on behalf of Steven Yen"
>  wrote:
>
> >What is a good way to grep multiple strings (say in a vector)? In the
> >following, I grep ants, cats, and fox separately and concatenate them,
> >is there a way to grep the trio in one action? Thanks.
> >
> >all<-c("ants","birds","cats","dogs","elks","fox"); all
> >[1] "ants"  "birds" "cats"  "dogs"  "elks"  "fox"
> >some<-c("ants","cats","fox"); some
> >[1] "ants" "cats" "fox"
> >j<-c(
> >   grep(some[1],all,value=F),
> >   grep(some[2],all,value=F),
> >   grep(some[3],all,value=F)); j; all[j]
> >[1] 1 3 6
> >[1] "ants" "cats" "fox"
> >
> >
> >   [[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-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.


Re: [R] how to perform multiple comparison?

2016-05-19 Thread David Winsemius

> On May 19, 2016, at 5:19 PM, Jim Lemon  wrote:
> 
> Hi laomeng_3,
> Have a look at the padjust function (stats).
> 
> Jim
> 
> 
> On Fri, May 20, 2016 at 1:56 AM, laomeng_3  wrote:
>> Hi all:
>> As to the anova, we can perform multiple comparison via TukeyHSD.
>> But as to chi-square test for frequency table,how to perform multiple 
>> comparison?
>> 
>> For example, if I want to compare 3 samples' ratio(the data has 3 rows,each 
>> row corresponds to 1 sample,and has 2 columns,each column corresponds to 
>> positive and negative respectively).
>> 
>> 
>> dat<-matrix(c(6,30,8,23,14,3),nrow=3)
>> dat
>>  [,1] [,2]
>> [1,]6   23
>> [2,]   30   14
>> [3,]83
>> 
>> 
>> 
>> chisq.test(dat)
>> 
>>   Pearson's Chi-squared test
>> 
>> data:  dat
>> X-squared = 17.9066, df = 2, p-value = 0.0001293
>> 
>> 
>> The result shows that the difference between the 3 samples is 
>> significant.But if I want to perform multiple comparison to find out which 
>> pair of samples is  significantly different,which function should be used?
>> 

It appears your question is which row(s) are contributing most greatly to the 
overall test of independence. The result of a `chisq.test(.)` (which is not 
what you see from its print method) has a component named residuals. (Read the 
help page : ?chisq.test)

x2 <- chisq.test(dat)
x2$residuals
   [,1]   [,2]
[1,] -2.3580463  2.4731398
[2,]  1.4481733 -1.5188569
[3,]  0.9323855 -0.9778942



Those row sums should be distributed as chi-squared statistics with one degree 
of freedom each, but since you have admittedly inflated the possibility of the 
type I error, it would be sensible to adjust the "p-statistics" using the 
function that Jim Lemon misspelled:

> rowSums(x2$residuals^2)
[1] 11.676803  4.404132  1.825620

> p.adjust( 1- pchisq( rowSums(x2$residuals^2), 1) )

[1] 0.001898526 0.071703921 0.176645786

So row 1 represents the only group that is "significantly different at the 
conventional level" from the expectations based on the overall sample 
collection. I also seem to remember that there is a function named CrossTable 
(in a package whose name I'm forgetting) that will deliver a SAS-style 
tabulation of row and column chi-squared statistics.

-- 
David.

>> 
>> Many thanks for your help.
>> 
>> My best
>> 
>> 
>> 
>> 发自 网易邮箱大师
>>[[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-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.

David Winsemius
Alameda, CA, USA

__
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] how to perform multiple comparison?

2016-05-19 Thread Jim Lemon
Hi laomeng_3,
Have a look at the padjust function (stats).

Jim


On Fri, May 20, 2016 at 1:56 AM, laomeng_3  wrote:
> Hi all:
> As to the anova, we can perform multiple comparison via TukeyHSD.
> But as to chi-square test for frequency table,how to perform multiple 
> comparison?
>
> For example, if I want to compare 3 samples' ratio(the data has 3 rows,each 
> row corresponds to 1 sample,and has 2 columns,each column corresponds to 
> positive and negative respectively).
>
>
> dat<-matrix(c(6,30,8,23,14,3),nrow=3)
> dat
>   [,1] [,2]
> [1,]6   23
> [2,]   30   14
> [3,]83
>
>
>
> chisq.test(dat)
>
>Pearson's Chi-squared test
>
> data:  dat
> X-squared = 17.9066, df = 2, p-value = 0.0001293
>
>
> The result shows that the difference between the 3 samples is significant.But 
> if I want to perform multiple comparison to find out which pair of samples is 
>  significantly different,which function should be used?
>
>
> Many thanks for your help.
>
> My best
>
>
>
> 发自 网易邮箱大师
> [[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-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] Grep command

2016-05-19 Thread MacQueen, Don
Start with:

> all <- c("ants","birds","cats","dogs","elks","fox")
> all[grep('ants|cats|fox',all)]
[1] "ants" "cats" "fox"

Then construct the first arg to grep:

> some <- c("ants","cats","fox")
> all[ grep( paste(some,collapse='|') , all)]
[1] "ants" "cats" "fox"



-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 5/19/16, 4:09 PM, "R-help on behalf of Steven Yen"
 wrote:

>What is a good way to grep multiple strings (say in a vector)? In the
>following, I grep ants, cats, and fox separately and concatenate them,
>is there a way to grep the trio in one action? Thanks.
>
>all<-c("ants","birds","cats","dogs","elks","fox"); all
>[1] "ants"  "birds" "cats"  "dogs"  "elks"  "fox"
>some<-c("ants","cats","fox"); some
>[1] "ants" "cats" "fox"
>j<-c(
>   grep(some[1],all,value=F),
>   grep(some[2],all,value=F),
>   grep(some[3],all,value=F)); j; all[j]
>[1] 1 3 6
>[1] "ants" "cats" "fox"
>
>
>   [[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-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] Grep command

2016-05-19 Thread David Winsemius

> On May 19, 2016, at 4:09 PM, Steven Yen  wrote:
> 
> What is a good way to grep multiple strings (say in a vector)? In the 
> following, I grep ants, cats, and fox separately and concatenate them, 
> is there a way to grep the trio in one action? Thanks.
> 
> all<-c("ants","birds","cats","dogs","elks","fox"); all
> [1] "ants"  "birds" "cats"  "dogs"  "elks"  "fox"
> some<-c("ants","cats","fox"); some
> [1] "ants" "cats" "fox"
> j<-c(
>   grep(some[1],all,value=F),
>   grep(some[2],all,value=F),
>   grep(some[3],all,value=F)); j; all[j]
> [1] 1 3 6
> [1] "ants" "cats" "fox"

j <- grep( paste0( some, collapse="|") , all ); j; all[j]
#--
[1] 1 3 6
[1] "ants" "cats" "fox" 

-- 

David Winsemius
Alameda, CA, USA

__
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] Can I use PhantomJS or assume a firefox instalattion for usage with RSelenium in CRAN Machines?

2016-05-19 Thread David Winsemius

> On May 19, 2016, at 7:49 AM, Marcelo Perlin  wrote:
> 
> Hi Guys,
> 
> First time posting here.
> 
> I have a CRAN package called GetTDData that downloads and reads public data
> from a government website (
> http://www.tesouro.fazenda.gov.br/tesouro-direto-balanco-e-estatisticas).
> 
> Recently (today), the website has changed its structure by removing
> permanent links of the files and creating a "random" html address for the
> files that really matter. This means that when I download the souce html
> code, I don't have the information for the actual links, but just a bunch
> of code.
> 
> In the past I have dealed with this type of problem by forcing the
> renderization of the page using RSelenium with firefox or PhantomJS and
> then capturing the desired href locations.
> 
> My question is, if integrate my code with RSelenium using firefox or
> PhantonJS, will it pass on all arquitectures (win, linux, solaris) of CRAN?

I dn't have a lot of experience at this but I can say that at least one person 
whose experience I trust recentlyreported in Rhelp that RSelenium tends to be a 
fragile interface. Nonetheless, he does use it on occasion and it clearly 
"works" on more than one platform. If your code is not confidential and the 
website has at least a guest login capacity, you could post it here and ask for 
trial runs on whatever platform(s) you may not have testing capacities for.

> 
> -- 
> Marcelo Perlin
> Professor Adjunto | Escola de Administração

--

David Winsemius
Alameda, CA, USA

__
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] Grep command

2016-05-19 Thread Peter Langfelder
I use my own functions multiGrep and multiGrepl:

multiGrep = function(patterns, x, ..., sort = TRUE, invert = FALSE)
{
  if (invert)
  {
out = multiIntersect(lapply(patterns, grep, x, ..., invert = TRUE))
  } else
out = unique(unlist(lapply(patterns, grep, x, ..., invert = FALSE)));
  if (sort) out = sort(out);
  out;
}

multiGrepl = function(patterns, x, ...)
{
  mat = do.call(cbind, lapply(patterns, function(p)
as.numeric(grepl(p, x, ...;
  rowSums(mat)>0;
}

> multiGrep(some, all)
[1] 1 3 6

> multiGrepl(some, all)
[1]  TRUE FALSE  TRUE FALSE FALSE  TRUE

multiGrep(some, all, invert = TRUE)
[1] 2 4 5

Peter


On Thu, May 19, 2016 at 4:09 PM, Steven Yen  wrote:
> What is a good way to grep multiple strings (say in a vector)? In the
> following, I grep ants, cats, and fox separately and concatenate them,
> is there a way to grep the trio in one action? Thanks.
>
> all<-c("ants","birds","cats","dogs","elks","fox"); all
> [1] "ants"  "birds" "cats"  "dogs"  "elks"  "fox"
> some<-c("ants","cats","fox"); some
> [1] "ants" "cats" "fox"
> j<-c(
>grep(some[1],all,value=F),
>grep(some[2],all,value=F),
>grep(some[3],all,value=F)); j; all[j]
> [1] 1 3 6
> [1] "ants" "cats" "fox"
>
>
> [[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-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] Grep command

2016-05-19 Thread Steven Yen
What is a good way to grep multiple strings (say in a vector)? In the 
following, I grep ants, cats, and fox separately and concatenate them, 
is there a way to grep the trio in one action? Thanks.

all<-c("ants","birds","cats","dogs","elks","fox"); all
[1] "ants"  "birds" "cats"  "dogs"  "elks"  "fox"
some<-c("ants","cats","fox"); some
[1] "ants" "cats" "fox"
j<-c(
   grep(some[1],all,value=F),
   grep(some[2],all,value=F),
   grep(some[3],all,value=F)); j; all[j]
[1] 1 3 6
[1] "ants" "cats" "fox"


[[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] error in data.farme--duplicate row.names error

2016-05-19 Thread MacQueen, Don
You will probably have to contact the maintainer of the package, since the
error appears to be generated inside the package's function.

Immediately after the error, type
  traceback()
The results might give you a clue. Or they might not!

There might be some requirements on the second argument of the
DefineGame() function. Check the help page for DefineGame and see if the
object you supplied, value, meets those requirements.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 5/19/16, 7:16 AM, "R-help on behalf of Rees, Lisa Marie (MU-Student)"
 wrote:

>I'm using the "GameTheory" package--- DefineGame(14,values) and values is
>equal to 16,383 observations.
>
>I keep getting the following error-
>[Error in data.frame(rep(0, 2^n - 1), row.names = Bmat) :
>  duplicate row.names: 1, 11, 111, 12, 112, 1112, 2, 13, 113, 1113,
>3, 1213, 11213, 111213, 213, 14, 114, 1114, 4, 1214, 11214,
>111214, 214, 1314, 11314, 111314, 314, 121314, 1121314, 11121314,
>21314]
>
>What can I do to fix this issue?  I would greatly appreciate any help.
>
>Thank you.
>
>
>
>   [[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-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] No map background showed up when adding tile in leaflet()

2016-05-19 Thread Lin, Ye
Hey All,

I am learning to create a map with leaflet(), but my default map background 
won't show up, its just grey.

Here is my code:

leaflet() %>% addTiles()
addCircleMarkers(lng=points$lon,lat=points$lat,
 radius=6,stroke=FALSE,fillOpacity = 0.5)

When I run the code, the markers show up and interaction of zoom in/out works 
okay, but background is always solid grey, not sure why. I tried 
"addProviderTiles("Stamen.TonerLabels")" as well, does not work out.

Thanks for your help in advance.

We respect your privacy. Please review our privacy policy for more information.
http://www.pge.com/en/about/company/privacy/customer/index.page

[[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] Fw: R STUDIO crashing

2016-05-19 Thread Bert Gunter
Rezvan:

"This is not help after keeping me waiting for long time. Such a waste
of time corresponding with you. "


You do understand that this is entirely a volunteer effort, do you
not? There is no guarantee that you will get any response at all, nor
that any that you do receive is actually helpful -- or even correct!
Caveat Emptor! (and your of getting useful help would probably be
improved by following the posting guide and exhibiting courteous,
respectful behavior to those who are volunteering their time to assist
you).


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 "Bloom County" comic strip )


On Thu, May 19, 2016 at 12:47 AM, rezvan hatami via R-help
 wrote:
>
>
>
> - Forwarded Message -
>  From: rezvan hatami 
>  To: Shige Song 
>  Sent: Thursday, 19 May 2016, 17:38
>  Subject: Re: [R] R STUDIO crashing
>
> I didn't say that there is a problem with R or Rstudio. I said, it keeps 
> crashing for whatever reason. If it is not crashing on your computer It 
> doesn't mean that it never might crash. This is not help after keeping me 
> waiting for long time. Such a waste of time corresponding with you.
>
>   From: Shige Song 
>  To: rezvan hatami 
> Cc: "r-help@r-project.org" 
>  Sent: Thursday, 19 May 2016, 14:55
>  Subject: Re: [R] R STUDIO crashing
>
> One thing for sure: It's not the fault of R nor Rstudio (because they are 
> doing fine on other people's computers, mine included). You can probably get 
> some help on the Rstudio support forum.
>
> On Wed, May 18, 2016 at 6:37 PM, rezvan hatami via R-help 
>  wrote:
>
> Hi there
> I have been using R for a while now. I am doing my PhD project with it. 
> Recently, it keeps crashing, mostly when I draw a graph and use XYPLOT code. 
> I even spent some money on cleaning registry, checking ram, deleting 
> unnecessary files from working directory. I used "plot(cars) and dev.off(). 
> First the">" sign disappears from the console and then if I try to remove the 
> plot or something else, the whole R freezes. When the ">" disappears, R 
> doesn't run the commands anymore. I searched all online questions and 
> answers, but I couldn't fix this. Please help me. PLEASE.
> Cheers
> Rezvan Hatami
> [[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-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] Vectorised operations

2016-05-19 Thread MacQueen, Don
In keeping with the theme of reducing unnecessary overhead
(and using William's example data)

> system.time( vAve <- ave(a, i, FUN=cummax) )
   user  system elapsed
  0.125   0.003   0.127
> system.time( b <- unlist( lapply( split(a,i) , cummax) ) )
   user  system elapsed
  0.320   0.007   0.327
> system.time( b <- unlist( lapply( split(a,i) , cummax) ,
>use.names=FALSE) )
   user  system elapsed
  0.067   0.001   0.068



> all.equal(vAve, b)
[1] TRUE

Apparently, quite a bit of overhead associated with keeping the names when
unlisting.


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 5/18/16, 7:26 AM, "R-help on behalf of William Dunlap via R-help"
 wrote:

>ave(A, i, FUN=cummax) loops but is faster than your aggregate-based
>solution.  E.g.,
>
>> i <- rep(1:1, sample(0:210, replace=TRUE, size=1))
>> length(i)
>[1] 1056119
>> a <- sample(-50:50, replace=TRUE, size=length(i))
>> system.time( vAve <- ave(a, i, FUN=cummax) )
>   user  system elapsed
>   0.130.030.16
>> system.time( vAggregate <-
>as.vector(unlist(aggregate(a,list(i),cummax)[[2]])) )
>   user  system elapsed
>   1.810.131.98
>> all.equal(vAve, vAggregate)
>[1] TRUE
>
>
>
>Bill Dunlap
>TIBCO Software
>wdunlap tibco.com
>
>On Wed, May 18, 2016 at 6:32 AM, John Logsdon <
>j.logs...@quantex-research.com> wrote:
>
>> Folks
>>
>> I have some very long vectors - typically 1 million long - which are
>> indexed by another vector, same length, with values from 1 to a few
>> thousand, sp each sub part of the vector may be a few hundred values
>>long.
>>
>> I want to calculate the cumulative maximum of each sub part the main
>> vector by the index in an efficient manner.  This can obviously be done
>>in
>> a loop but the whole calculation is embedded within many other
>> calculations which would make everything very slow indeed.  All the
>>other
>> sums are vectorised already.
>>
>> For example,
>>
>> A=c(1,2,1,  -3,5,6,7,4,  6,3,7,6,9, ...)
>> i=c(1,1,1,   2,2,2,2,2,  3,3,3,3,3, ...)
>>
>> where A has three levels that are not the same but the levels themselves
>> are all monotonic non-decreasing.
>>
>> the answer to be a vector of the same length:
>>
>> R=c(1,2,2,  -3,5,6,7,7,  6,6,7,7,9, ...)
>>
>> If I could reset the cumulative maximum to -1e6 (eg) at each change of
>> index, a simple cummax would do but I can't see how to do this.
>>
>> The best way I have found so far is to use the aggregate command:
>>
>> as.vector(unlist(aggregate(a,list(i),cummax)[[2]]))
>>
>> but rarely this fails, returning a shorter vector than expected and
>>seems
>> rather ugly,  converting to and from lists which may well be an
>> unnecessary overhead.
>>
>> I have been trying other approaches using apply() methods but either it
>> can't be done using them or I can't get my head round them!
>>
>> Any ideas?
>>
>> Best wishes
>>
>> John
>>
>> John Logsdon
>> Quantex Research Ltd
>> +44 161 445 4951/+44 7717758675
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 
>>https://secure-web.cisco.com/1db6hsP9YKn27F8A9c3lLtE4FDoYVpnnKmVgP0ZTGuPp
>>rrXWaCCwKPZt-pMgmapmF56MrgngzykSrZV_gXR2fFi1PX6vWBRDFYUhqF2AyuCUF2v4-ZN-8
>>q7fO3mBBnj_2k4lYyx46FqHtq2YNFkc-Hsh3zRxdA0WP8-5LlqRS76CzguBuwflIHhF6RC9n8
>>bi4GGTgNwUAZkfBIBU1Sq2Um1UovWcAe6Su1C7PC6N8LMqOBxCzdIjLT5P_esNZi3t5WiA7U9
>>DdEXxH-RdLJVyrMLmjvyuoCBYponGY4gRxSKSAIB-PuWULy7N1CGCGfMbmeN5tF1NsCnENwLS
>>NH29UinTSrcPwdtvMMh_2PKZ0CjY/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flisti
>>nfo%2Fr-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://secure-web.cisco.com/1db6hsP9YKn27F8A9c3lLtE4FDoYVpnnKmVgP0ZTGuPpr
>rXWaCCwKPZt-pMgmapmF56MrgngzykSrZV_gXR2fFi1PX6vWBRDFYUhqF2AyuCUF2v4-ZN-8q7
>fO3mBBnj_2k4lYyx46FqHtq2YNFkc-Hsh3zRxdA0WP8-5LlqRS76CzguBuwflIHhF6RC9n8bi4
>GGTgNwUAZkfBIBU1Sq2Um1UovWcAe6Su1C7PC6N8LMqOBxCzdIjLT5P_esNZi3t5WiA7U9DdEX
>xH-RdLJVyrMLmjvyuoCBYponGY4gRxSKSAIB-PuWULy7N1CGCGfMbmeN5tF1NsCnENwLSNH29U
>inTSrcPwdtvMMh_2PKZ0CjY/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2F
>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.


Re: [R] ggplot2 not displaying graph in RH7 RStudio Server 3.2.3

2016-05-19 Thread Tom Wright
I just tested your code on my debian install with no problems. RStudio
server logs messages to /var/log/messages (on redhat). Does running:

$ cat /var/log/messages |grep rsession

$ cat /var/log/messages |grep rserver

in the shell give any clues?



R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

locale:
 [1] LC_CTYPE=en_CA.UTF-8   LC_NUMERIC=C
LC_TIME=en_CA.UTF-8LC_COLLATE=en_CA.UTF-8
 [5] LC_MONETARY=en_CA.UTF-8LC_MESSAGES=en_CA.UTF-8
LC_PAPER=en_CA.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] ggplot2_2.1.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.4splines_3.2.5  MASS_7.3-45
munsell_0.4.3  colorspace_1.2-6   xtable_1.8-2
 [7] lattice_0.20-33multcomp_1.4-4 minqa_1.2.4
plyr_1.8.3 tools_3.2.5pbkrtest_0.4-6
[13] parallel_3.2.5 grid_3.2.5 nlme_3.1-126
gtable_0.2.0   TH.data_1.0-7  coda_0.18-1
[19] survival_2.38-3lme4_1.1-11Matrix_1.2-4
nloptr_1.0.4   codetools_0.2-14   labeling_0.3
[25] sandwich_2.3-4 estimability_1.1-1 lsmeans_2.23
scales_0.4.0   mvtnorm_1.0-5  zoo_1.7-12


On Wed, May 18, 2016 at 8:57 AM,  wrote:

>
>
> Here's a minimal example that displays a bar chart in RStudio 3.2.4 for
> Windows, but not in RStudio Server 3.2.3 on RH Linux 7:
>
> --- R Code
> ---
>
> library(ggplot2)
> a <- c("ab", "bc", "cd")
> b <- c("de", "fg", "hi")
> ds <- data.frame(a,b)
> g1 <- ggplot(data = ds, aes(x=a))
> g1 + geom_bar(stat="count", fill=rainbow(3), colour="black") +
> xlab("Action & Description") + ylab("Count")  +  ggtitle("test") +
> coord_flip()
>
>
> --
>
> --- sessionInfo on
> Windows --
>
> R version 3.2.4 Revised (2016-03-16 r70336)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] gridExtra_2.2.1 ggthemes_3.0.2  lubridate_1.5.0 RJDBC_0.2-5
>  rJava_0.9-8
> [6] DBI_0.3.1   ggplot2_2.1.0
>
> loaded via a namespace (and not attached):
>  [1] Rcpp_0.12.4assertthat_0.1 grid_3.2.4 plyr_1.8.3
>  [5] gtable_0.2.0   magrittr_1.5   scales_0.4.0   stringi_1.0-1
>  [9] labeling_0.3   tools_3.2.4stringr_1.0.0  munsell_0.4.3
> [13] rsconnect_0.4.1.11 colorspace_1.2-6
> >
>
>
> 
>
> - sessionInfo on
> RH Linux 7 ---
>
> R version 3.2.3 (2015-12-10)
> Platform: x86_64-redhat-linux-gnu (64-bit)
> Running under: Red Hat Enterprise Linux
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>  LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
>  LC_MONETARY=en_US.UTF-8
>  [6] LC_MESSAGES=en_US.UTF-8LC_PAPER=en_US.UTF-8   LC_NAME=C
> LC_ADDRESS=C   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] gridExtra_2.2.1 ggthemes_3.0.3  ggplot2_2.1.0   lubridate_1.5.6
> RJDBC_0.2-5 rJava_0.9-8 DBI_0.4-1
>
> loaded via a namespace (and not attached):
>  [1] Rcpp_0.12.5  assertthat_0.1   grid_3.2.3   plyr_1.8.3
>  gtable_0.2.0 magrittr_1.5 scales_0.4.0 stringi_1.0-1
>  [9] tools_3.2.3  stringr_1.0.0munsell_0.4.3colorspace_1.2-6
>
>
> --
>
>
>
>
>
> - Mail original -
> De: "Jeff Newmiller" 
> À: phi...@free.fr, r-help@r-project.org
> Envoyé: Mercredi 18 Mai 2016 14:36:50
> Objet: Re: [R] ggplot2 not displaying graph in RH7 RStudio Server 3.2.3
>
> Context is everything. Please follow the Posting Guide and provide a
> minimal reproducible example. Also, if your scripts are literally the same
> on the two 

Re: [R] error in data.farme--duplicate row.names error

2016-05-19 Thread Rees, Lisa Marie (MU-Student)
Michael,

Thanks for your response.  

I tried table(table(Bmat)) and it gave me the following error:
[  Error in table(Bmat) : object 'Bmat' not found]

FYI--
"values" contains 16,383 observations ranging from 0 to less than 1.

Lisa



-Original Message-
From: Michael Dewey [mailto:li...@dewey.myzen.co.uk] 
Sent: Thursday, May 19, 2016 11:05 AM
To: Rees, Lisa Marie (MU-Student); r-help@r-project.org
Subject: Re: [R] error in data.farme--duplicate row.names error

Dear Lisa

What does Bmat contain? Perhaps try table(table(Bmat)) and see if any entries 
are greater than unity.

On 19/05/2016 15:16, Rees, Lisa Marie (MU-Student) wrote:
> I'm using the "GameTheory" package--- DefineGame(14,values) and values is 
> equal to 16,383 observations.
>
> I keep getting the following error-
> [Error in data.frame(rep(0, 2^n - 1), row.names = Bmat) :
>   duplicate row.names: 1, 11, 111, 12, 112, 1112, 2, 13, 113, 
> 1113, 3, 1213, 11213, 111213, 213, 14, 114, 1114, 4, 1214, 
> 11214, 111214, 214, 1314, 11314, 111314, 314, 121314, 1121314, 
> 11121314, 21314]
>
> What can I do to fix this issue?  I would greatly appreciate any help.
>
> Thank you.
>
>
>
>   [[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.
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] how to perform multiple comparison?

2016-05-19 Thread laomeng_3
Hi all:
As to the anova, we can perform multiple comparison via TukeyHSD.
But as to chi-square test for frequency table,how to perform multiple 
comparison?

For example, if I want to compare 3 samples' ratio(the data has 3 rows,each row 
corresponds to 1 sample,and has 2 columns,each column corresponds to positive 
and negative respectively).


dat<-matrix(c(6,30,8,23,14,3),nrow=3)
dat
  [,1] [,2]
[1,]6   23
[2,]   30   14
[3,]83



chisq.test(dat)

   Pearson's Chi-squared test

data:  dat
X-squared = 17.9066, df = 2, p-value = 0.0001293


The result shows that the difference between the 3 samples is significant.But 
if I want to perform multiple comparison to find out which pair of samples is  
significantly different,which function should be used?


Many thanks for your help.

My best



 ��ʦ
[[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] error in data.farme--duplicate row.names error

2016-05-19 Thread Michael Dewey

Dear Lisa

What does Bmat contain? Perhaps try table(table(Bmat)) and see if any 
entries are greater than unity.


On 19/05/2016 15:16, Rees, Lisa Marie (MU-Student) wrote:

I'm using the "GameTheory" package--- DefineGame(14,values) and values is equal 
to 16,383 observations.

I keep getting the following error-
[Error in data.frame(rep(0, 2^n - 1), row.names = Bmat) :
  duplicate row.names: 1, 11, 111, 12, 112, 1112, 2, 13, 113, 1113, 3, 
1213, 11213, 111213, 213, 14, 114, 1114, 4, 1214, 11214, 111214, 
214, 1314, 11314, 111314, 314, 121314, 1121314, 11121314, 21314]

What can I do to fix this issue?  I would greatly appreciate any help.

Thank you.



[[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.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] remove fixed effect in predict.merMod

2016-05-19 Thread Alexander Shenkin

Hello all,

I've run a model, and now would like to extract residuals.  However, I 
have set sum-to-zero contrasts for the categorical fixed effect 
(contr.sum).  Because I am interested in looking at the variation in the 
residuals associated with that fixed effect (along with other levels), I 
need to calculate residuals setting that fixed effect to zero.  Any 
thoughts on how to do this?


thanks,
allie



contr.sum.keepnames <- function(...) {
# make deviation contrasts that don't lose the names of the factors 
in the model results
# from 
https://stackoverflow.com/questions/10808853/why-does-changing-contrast-type-change-row-labels-in-r-lm-summary

conS <- contr.sum(...)
colnames(conS) = rownames(conS)[-length(rownames(conS))]
conS
}

test_df = data.frame(site = rep(LETTERS[1:10], 10), resp = runif(100), 
pred = runif(100))


contrasts(test_df$site) = contr.sum.keepnames(levels(test_df$site))

mod = lmer(resp ~ (1 + pred|site) + pred, data = test_df)

residuals = test_df$resp - predict(mod, REform=NA) # I would like the 
site effect here to be set to zero


__
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] Fw: R STUDIO crashing

2016-05-19 Thread rezvan hatami via R-help


 
- Forwarded Message -
 From: rezvan hatami 
 To: Shige Song  
 Sent: Thursday, 19 May 2016, 17:38
 Subject: Re: [R] R STUDIO crashing
   
I didn't say that there is a problem with R or Rstudio. I said, it keeps 
crashing for whatever reason. If it is not crashing on your computer It doesn't 
mean that it never might crash. This is not help after keeping me waiting for 
long time. Such a waste of time corresponding with you.

  From: Shige Song 
 To: rezvan hatami  
Cc: "r-help@r-project.org" 
 Sent: Thursday, 19 May 2016, 14:55
 Subject: Re: [R] R STUDIO crashing
  
One thing for sure: It's not the fault of R nor Rstudio (because they are doing 
fine on other people's computers, mine included). You can probably get some 
help on the Rstudio support forum. 

On Wed, May 18, 2016 at 6:37 PM, rezvan hatami via R-help 
 wrote:

Hi there
I have been using R for a while now. I am doing my PhD project with it. 
Recently, it keeps crashing, mostly when I draw a graph and use XYPLOT code. I 
even spent some money on cleaning registry, checking ram, deleting unnecessary 
files from working directory. I used "plot(cars) and dev.off(). First the">" 
sign disappears from the console and then if I try to remove the plot or 
something else, the whole R freezes. When the ">" disappears, R doesn't run the 
commands anymore. I searched all online questions and answers, but I couldn't 
fix this. Please help me. PLEASE.
Cheers
Rezvan Hatami
        [[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.

Re: [R] Placement of words in a word cloud as per its occurance.

2016-05-19 Thread shaila shailaja
Thank you Peter for pointing out my errors.

I shall take care of if henceforth.

To keep the mail short I left out the details, sorry about that.





I am usingwordcloud packageto built a comparative and commonality 
cloud. 



My usage: 



comparison.cloud(term.matrix,max.words=300)commonality.cloud(term.matrix,random.order=FALSE,
 rot.per=0)



I am alreadydoing a lot of preprocessing and the sentence is not limited 
to 1 or 2.

The words in the word cloud are placed in random order if random.order=FALSE 
then it is placed according to its frequency.



I want the same order as the sentence minus the stop words. 



Thanks,

ShailajaFrom: peter dalgaard pda...@gmail.comSent: Wed, 18 May 2016 
13:34:05 To: shaila shailaja shaila...@rediffmail.comCc: 
"r-help@r-project.org" r-help@r-project.orgSubject: Re: [R] Placement 
of words in a word cloud as per its occurance.A few points of order; you seem 
to be making a couple of rookie mistakes here. (Don't take it personally, lots 
of people do).1) Posting in HTML comes across garbled (and it can get much 
worse than what you see below), so please configure you mail program to avoid 
doing that.2) You seem to assume that we all immediately recognize the task you 
are working on and that there is a well-known and generally accepted 
methodology for which we just need to supply some detail that you have 
overlooked. In fact, the majority will be doing things in hundreds of different 
directions, and even those who are into wordclouds may be taking different 
approaches to it, there could be implementations in several packages, etc. Some 
peopl!
 e might be mildly interested in helping out (perhaps they want to make a 
wordcloud for themselves one day), but they would need to know what code you 
are using. As it stands, people are left wondering which function it might be 
that has an argument called random.order.- Peter DalgaardOn 17 May 2016, at 
13:09 ,shaila shailaja shaila...@rediffmail.com wrote: Dear R 
help subscribers, I am working on a word cloud where in 
I want the words to appear in the same order as in the sentence/text.   
I only knownbsp;the random.order -nbsp;which plots words in random 
order. If false, they will be plotted in decreasing frequency.  
nbsp;  Any help is most welcome.  nbsp;  
Regards  Shailaja [[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.-- Peter Dalgaard, Professor,Center 
for Statistics, Copenhagen Business SchoolSolbjerg Plads 3, 2000 Frederiksberg, 
DenmarkPhone: (+45)38153501Office: A 4.23Email: pd@cbs.dk Priv: 
PDalgd@gmail.com__r-h...@r-project.org
 mailing list -- To UNSUBSCRIBE and more, 
seehttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide 
http://www.R-project.org/posting-guide.htmland 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] Can I use PhantomJS or assume a firefox instalattion for usage with RSelenium in CRAN Machines?

2016-05-19 Thread Marcelo Perlin
Hi Guys,

First time posting here.

I have a CRAN package called GetTDData that downloads and reads public data
from a government website (
http://www.tesouro.fazenda.gov.br/tesouro-direto-balanco-e-estatisticas).

Recently (today), the website has changed its structure by removing
permanent links of the files and creating a "random" html address for the
files that really matter. This means that when I download the souce html
code, I don't have the information for the actual links, but just a bunch
of code.

In the past I have dealed with this type of problem by forcing the
renderization of the page using RSelenium with firefox or PhantomJS and
then capturing the desired href locations.

My question is, if integrate my code with RSelenium using firefox or
PhantonJS, will it pass on all arquitectures (win, linux, solaris) of CRAN?

I'm happy to hear any other ideas.

Many thanks!

-- 
Marcelo Perlin
Professor Adjunto | Escola de Administração
Universidade Federal do Rio Grande do Sul
Rua Washington Luiz, 855 | 90010-460| Porto Alegre RS| Brasil
Tel.: (51) 3308-3303 | www.ea.ufrgs.br
http://lattes.cnpq.br/3262699324398819
https://sites.google.com/site/marceloperlin/

[[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] error in data.farme--duplicate row.names error

2016-05-19 Thread Rees, Lisa Marie (MU-Student)
I'm using the "GameTheory" package--- DefineGame(14,values) and values is equal 
to 16,383 observations.

I keep getting the following error-
[Error in data.frame(rep(0, 2^n - 1), row.names = Bmat) :
  duplicate row.names: 1, 11, 111, 12, 112, 1112, 2, 13, 113, 1113, 3, 
1213, 11213, 111213, 213, 14, 114, 1114, 4, 1214, 11214, 111214, 
214, 1314, 11314, 111314, 314, 121314, 1121314, 11121314, 21314]

What can I do to fix this issue?  I would greatly appreciate any help.

Thank you.



[[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] x-axis tick marks on log scale plot

2016-05-19 Thread Brian Smith
Thanks all !!

On Thu, May 19, 2016 at 9:55 AM, Ivan Calandra 
wrote:

> Hi,
>
> You can do it by first plotting your values without the x-axis:
> plot(x,y,log="xy", xaxt="n")
>
> and then plotting the x-axis with ticks where you need to:
> axis(side=1, at=seq(2000,8000,1000))
>
> HTH,
> Ivan
>
> --
> Ivan Calandra, PhD
> Scientific Mediator
> University of Reims Champagne-Ardenne
> GEGENAA - EA 3795
> CREA - 2 esplanade Roland Garros
> 51100 Reims, France
> +33(0)3 26 77 36 89
> ivan.calan...@univ-reims.fr
> --
> https://www.researchgate.net/profile/Ivan_Calandra
> https://publons.com/author/705639/
>
>
> Le 19/05/2016 à 15:40, Brian Smith a écrit :
>
>> Hi,
>>
>> I have a plot with log scale on the axes. How do I add ticks and labels in
>> addition to the ones provided by default? Can I specify where I want the
>> ticks and labels?
>>
>> For example:
>>
>> set.seed(12345)
>> x <- sample(1:1,10)
>> y <- sample(1:1,10)
>>
>> plot(x,y,log="xy")
>>
>>
>> For me, this plot has tick marks (and labels) at 2000, 4000, 6000, 8000.
>> How can I make the axes so that it has marks and labels at 1000 intervals
>> (i.e. 2000, 3000, 4000, etc.)
>>
>> thanks!
>>
>> [[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-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.

Re: [R] x-axis tick marks on log scale plot

2016-05-19 Thread Ivan Calandra

Hi,

You can do it by first plotting your values without the x-axis:
plot(x,y,log="xy", xaxt="n")

and then plotting the x-axis with ticks where you need to:
axis(side=1, at=seq(2000,8000,1000))

HTH,
Ivan

--
Ivan Calandra, PhD
Scientific Mediator
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 19/05/2016 à 15:40, Brian Smith a écrit :

Hi,

I have a plot with log scale on the axes. How do I add ticks and labels in
addition to the ones provided by default? Can I specify where I want the
ticks and labels?

For example:

set.seed(12345)
x <- sample(1:1,10)
y <- sample(1:1,10)

plot(x,y,log="xy")


For me, this plot has tick marks (and labels) at 2000, 4000, 6000, 8000.
How can I make the axes so that it has marks and labels at 1000 intervals
(i.e. 2000, 3000, 4000, etc.)

thanks!

[[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-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] x-axis tick marks on log scale plot

2016-05-19 Thread Duncan Murdoch

On 19/05/2016 9:40 AM, Brian Smith wrote:

Hi,

I have a plot with log scale on the axes. How do I add ticks and labels in
addition to the ones provided by default? Can I specify where I want the
ticks and labels?

For example:

set.seed(12345)
x <- sample(1:1,10)
y <- sample(1:1,10)

plot(x,y,log="xy")


For me, this plot has tick marks (and labels) at 2000, 4000, 6000, 8000.
How can I make the axes so that it has marks and labels at 1000 intervals
(i.e. 2000, 3000, 4000, etc.)


You'll get ticks on side 1 (the x axis) by using

axis(1, at=1000*(2:10))

You'll get labels at some of those locations; R will leave some out, if 
it looks as though the labels will overlap.  Using las=2 will make them 
perpendicular to the axis, and all should be drawn.


Duncan Murdoch

__
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] x-axis tick marks on log scale plot

2016-05-19 Thread Brian Smith
Hi,

I have a plot with log scale on the axes. How do I add ticks and labels in
addition to the ones provided by default? Can I specify where I want the
ticks and labels?

For example:

set.seed(12345)
x <- sample(1:1,10)
y <- sample(1:1,10)

plot(x,y,log="xy")


For me, this plot has tick marks (and labels) at 2000, 4000, 6000, 8000.
How can I make the axes so that it has marks and labels at 1000 intervals
(i.e. 2000, 3000, 4000, etc.)

thanks!

[[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] Install GARPFRM package

2016-05-19 Thread Ogbos Okike
Hi Saba,
Your main worry may be that of non- zero status and hence your attempt to
load what the system claims you have. I have encountered such problems
severally. You can try two things: run it several times ( network issues
might play a role) or try different crab mirrors.
Ogbos
On May 19, 2016 5:53 AM, "Saba Sehrish via R-help" 
wrote:

> Hi
>
> I am trying to install GARPFRM package to R (version: 3.3.0) by following
> steps:
>
> (a)  install.packages("GARPFRM", repos="http://R-Forge.R-project.org;)
>
> It gives following Warning messages:
>
> 1: running command '"C:/PROGRA~1/R/R-33~1.0/bin/i386/R" CMD INSTALL -l
> "C:\Users\ssehrish\Documents\R\win-library\3.3"
> C:\Users\ssehrish\AppData\Local\Temp\RtmpU3JvBo/downloaded_packages/GARPFRM_0.1.0.tar.gz'
> had status 1
>
>
> 2: In install.packages("GARPFRM", repos = "http://R-Forge.R-project.org;)
> :  installation of package ‘GARPFRM’ had non-zero exit status
>
>
> (b) library(GARPFRM)
>
> It gives following error :  Error in library(GARPFRM) : there is no
> package called ‘GARPFRM’
>
> Please help me in this regard.
>
> Thanks
> Saba
>
> __
> 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.

Re: [R] R STUDIO crashing

2016-05-19 Thread Joe Ceradini
Also, this starting happening for me with R studio 0.99.893, so if you have
a different version, maybe it is a different issue (or maybe it is a
different issue regardless...).

Joe

On Thu, May 19, 2016 at 7:27 AM, Joe Ceradini  wrote:

> I had this problem as well, a lot, and it was frustrating and I did not
> find much reference to it online. I believe it occurs after you run a plot
> and then make the plotting window too small for R studio to redraw the
> plot. Then when run a line of code, it never runs or appears to be running
> indefinitely. The "STOP" sign does not show up either, so you cannot stop
> the process that way - I always had to force stop via control alt delete.
> After I starting paying attention to either clearing all plots or keeping
> the size of the window big enough to draw the plot, the problem totally
> stopped. I do not know/understand what the underlying problem is, but
> hopefully it is resolved in newer versions.
>
> Joe
>
> On Wed, May 18, 2016 at 10:55 PM, Shige Song  wrote:
>
>> One thing for sure: It's not the fault of R nor Rstudio (because they are
>> doing fine on other people's computers, mine included). You can probably
>> get some help on the Rstudio support forum.
>>
>> On Wed, May 18, 2016 at 6:37 PM, rezvan hatami via R-help <
>> r-help@r-project.org> wrote:
>>
>> > Hi there
>> > I have been using R for a while now. I am doing my PhD project with it.
>> > Recently, it keeps crashing, mostly when I draw a graph and use XYPLOT
>> > code. I even spent some money on cleaning registry, checking ram,
>> deleting
>> > unnecessary files from working directory. I used "plot(cars) and
>> dev.off().
>> > First the">" sign disappears from the console and then if I try to
>> remove
>> > the plot or something else, the whole R freezes. When the ">"
>> disappears, R
>> > doesn't run the commands anymore. I searched all online questions and
>> > answers, but I couldn't fix this. Please help me. PLEASE.
>> > Cheers
>> > Rezvan Hatami
>> > [[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.
>>
>
>
>
> --
> Cooperative Fish and Wildlife Research Unit
> Zoology and Physiology Dept.
> University of Wyoming
> joecerad...@gmail.com / 914.707.8506
> wyocoopunit.org
>
>


-- 
Cooperative Fish and Wildlife Research Unit
Zoology and Physiology Dept.
University of Wyoming
joecerad...@gmail.com / 914.707.8506
wyocoopunit.org

[[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] R STUDIO crashing

2016-05-19 Thread Joe Ceradini
I had this problem as well, a lot, and it was frustrating and I did not
find much reference to it online. I believe it occurs after you run a plot
and then make the plotting window too small for R studio to redraw the
plot. Then when run a line of code, it never runs or appears to be running
indefinitely. The "STOP" sign does not show up either, so you cannot stop
the process that way - I always had to force stop via control alt delete.
After I starting paying attention to either clearing all plots or keeping
the size of the window big enough to draw the plot, the problem totally
stopped. I do not know/understand what the underlying problem is, but
hopefully it is resolved in newer versions.

Joe

On Wed, May 18, 2016 at 10:55 PM, Shige Song  wrote:

> One thing for sure: It's not the fault of R nor Rstudio (because they are
> doing fine on other people's computers, mine included). You can probably
> get some help on the Rstudio support forum.
>
> On Wed, May 18, 2016 at 6:37 PM, rezvan hatami via R-help <
> r-help@r-project.org> wrote:
>
> > Hi there
> > I have been using R for a while now. I am doing my PhD project with it.
> > Recently, it keeps crashing, mostly when I draw a graph and use XYPLOT
> > code. I even spent some money on cleaning registry, checking ram,
> deleting
> > unnecessary files from working directory. I used "plot(cars) and
> dev.off().
> > First the">" sign disappears from the console and then if I try to remove
> > the plot or something else, the whole R freezes. When the ">"
> disappears, R
> > doesn't run the commands anymore. I searched all online questions and
> > answers, but I couldn't fix this. Please help me. PLEASE.
> > Cheers
> > Rezvan Hatami
> > [[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.
>



-- 
Cooperative Fish and Wildlife Research Unit
Zoology and Physiology Dept.
University of Wyoming
joecerad...@gmail.com / 914.707.8506
wyocoopunit.org

[[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] RSTUDIO keeps crashing-please help me

2016-05-19 Thread John Kane
What happens if you run R in a console or the Windows GUI if you are using 
Windows

We need to isolate the issue as an R issue or an RStudio one or a local 
computer one.  My experience is that occasionally RStudio will do something a 
bit weird but usually rebooting RStudio  cures it.

If it appears to be an RStudio problem you will need to go to the RStudio 
support. 

For some general suggestions on how to ask questions here have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and/or http://adv-r.had.co.nz/Reproducibility.html


John Kane
Kingston ON Canada


> -Original Message-
> From: r-help@r-project.org
> Sent: Wed, 18 May 2016 10:46:02 + (UTC)
> To: r-help@r-project.org
> Subject: [R] RSTUDIO keeps crashing-please help me
> 
> Hi there
> I have been using R for a while now. I am doing my PhD project with it.
> Recently, it keeps crashing, mostly when I draw a graph and use XYPLOT
> code. I even spent some money on cleaning registry, checking ram,
> deleting unnecessary files from working directory. I used "plot(cars)
> and dev.off(). First the">" sign disappears from the console and then if
> I try to remove the plot or something else, the whole R freezes. When the
> ">" disappears, R doesn't run the commands anymore. I searched all online
> questions and answers, but I couldn't fix this. I also uninstalled
> Rstudio and reinstalled it. Would you please help me?Please help me.
> PLEASE.
> Cheers
> Rezvan Hatami
>   [[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.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
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] RSTUDIO keeps crashing-please help me

2016-05-19 Thread Duncan Murdoch

On 18/05/2016 6:46 AM, rezvan hatami via R-help wrote:

Hi there
I have been using R for a while now. I am doing my PhD project with it. Recently, it keeps crashing, mostly 
when I draw a graph and use XYPLOT code. I even spent some money on cleaning registry, checking ram, deleting 
unnecessary files from working directory. I used "plot(cars) and dev.off(). First the">" 
sign disappears from the console and then if I try to remove the plot or something else, the whole R freezes. 
When the ">" disappears, R doesn't run the commands anymore. I searched all online questions and 
answers, but I couldn't fix this. I also uninstalled Rstudio and reinstalled it. Would you please help 
me?Please help me. PLEASE.


Do the crashes happen in R if you run it without RStudio?  If not, this 
is something you need to report to the RStudio people, not here.


If they do happen in plain R, try running with the --vanilla option.  If 
that is fine, the problem is probably something you have in your saved 
workspace, or in one of the startup files.


Duncan Murdoch

__
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] 3D plots in R.3.2.3

2016-05-19 Thread Denis Francisci
For 3D scatterplot you can use also "scatterplot3d" package.

2016-05-19 8:40 GMT+02:00 David Winsemius :

>
> > On May 18, 2016, at 7:51 AM, ch.elahe via R-help 
> wrote:
> >
> >
> > Hi all,
> > I am using R version 3.2.3 and I want to plot 3D histogram or 3D
> scatterplot. Does anyone know which packages can be used for this version
> for 3D plots? I tried plot3d but it's not working for this version.
>
> Perhaps you =misspelled the package name. I see no plot3d package. (But
> there is a plot3D package.)
>
>
> --
> David Winsemius
> Alameda, CA, USA
>
> __
> 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.


Re: [R] 3D plots in R.3.2.3

2016-05-19 Thread David Winsemius

> On May 18, 2016, at 7:51 AM, ch.elahe via R-help  wrote:
> 
> 
> Hi all,
> I am using R version 3.2.3 and I want to plot 3D histogram or 3D scatterplot. 
> Does anyone know which packages can be used for this version for 3D plots? I 
> tried plot3d but it's not working for this version.

Perhaps you =misspelled the package name. I see no plot3d package. (But there 
is a plot3D package.)


-- 
David Winsemius
Alameda, CA, USA

__
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] Install GARPFRM package

2016-05-19 Thread Saba Sehrish via R-help
Hi

If a package is not loading, it is a matter of concern. Therefore, I have asked 
for the assistance or guidance in this regards.

Saba

__
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] Install GARPFRM package

2016-05-19 Thread David Winsemius

> On May 18, 2016, at 9:51 PM, Saba Sehrish via R-help  
> wrote:
> 
> Hi
> 
> I am trying to install GARPFRM package to R (version: 3.3.0) by following 
> steps:
> 
> (a)  install.packages("GARPFRM", repos="http://R-Forge.R-project.org;)
> 
> It gives following Warning messages:
> 
> 1: running command '"C:/PROGRA~1/R/R-33~1.0/bin/i386/R" CMD INSTALL -l 
> "C:\Users\ssehrish\Documents\R\win-library\3.3" 
> C:\Users\ssehrish\AppData\Local\Temp\RtmpU3JvBo/downloaded_packages/GARPFRM_0.1.0.tar.gz'
>  had status 1 
> 

.tar.gz packages are source packages. The default for the install.packages 
function is for binary packages. (Generally you will not find binary packages 
on R-Forge.)

You should read the help pages for install.packages.


> 
> 2: In install.packages("GARPFRM", repos = "http://R-Forge.R-project.org;) :  
> installation of package ‘GARPFRM’ had non-zero exit status
> 
> 
> (b) library(GARPFRM)
> 
> It gives following error :  Error in library(GARPFRM) : there is no package 
> called ‘GARPFRM’
> 

Trying to load a package which failed to install should not surprise you.

-- 

David Winsemius
Alameda, CA, USA

__
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.