Re: [R] Run script R

2016-04-09 Thread Berend Hasselman
Please do NOT post in html as the posting guide tells you. Post in plain text. Your R code is a complete mess and unreadable. Berend > On 10 Apr 2016, at 01:51, Mohamed Benahmed via R-help > wrote: > > hi all , > i have an problem in script R . But when I execute the script R I face this >

[R] How to print the graphs in landscape/portrait orientation (revised)

2016-04-09 Thread jpm miao
Hi, I made a few graphs by ggplot. The following codes produce a pdf file with graphs, sometimes in landscape orientation, sometimes in portrait orientation. I am using both Mac and Windows PC. Question: how can I control the orientation of the pdf file? I try to add a line pdf(pap

[R] Run script R

2016-04-09 Thread Mohamed Benahmed via R-help
hi all ,  i have an problem in script R . But when I execute the script R I face this error . can you help me please ??  error:- Error in FUN(X[[i]], ...) :   Theme element 'text' has NULL property: margin, debugIn addition: Warning messages:1: Removed 361

[R] fast way to search for a pattern in a few million entries data frame

2016-04-09 Thread Fabien Tarrade
Hi there, I have a data frame DF with 40 millions strings and their frequency. I am searching for strings with a given pattern and I am trying to speed up this part of my code. I try many options but so far I am not satisfied. I tried: - grepl and subset are equivalent in term of processing t

Re: [R] Quantmod abline and axis configuration

2016-04-09 Thread Joshua Ulrich
On Sat, Apr 9, 2016 at 2:14 PM, bgnumis bgnum wrote: > Hi all, > > I have this code > > > I want to add two ablines like this > > abline(h=2400, lty=3, col="lightgrey") > > abline(h=400, lty=3, col="lightgrey") > > But doesnt wotk. > Use addLines(). It does what abline() does, although you cannot

Re: [R] How to print the graphs in landscape/portrait orientation

2016-04-09 Thread Duncan Murdoch
On 09/04/2016 5:58 PM, jpm miao wrote: Hi, I made a few graphs by ggplot. The following codes produce a pdf file with graphs in landscape orientation on my Windows PC, while they produce a pdf file with the same graphs, but in portrait orientation: *p2 <- lapply(1:(2*n), function(.x) xyz_ou

[R] How to print the graphs in landscape/portrait orientation

2016-04-09 Thread jpm miao
Hi, I made a few graphs by ggplot. The following codes produce a pdf file with graphs in landscape orientation on my Windows PC, while they produce a pdf file with the same graphs, but in portrait orientation: *p2 <- lapply(1:(2*n), function(.x) xyz_outl[.x][[1]]) #a sequence of graphs made b

Re: [R] assign

2016-04-09 Thread Fox, John
Hi Georges, Very clever, and your first solution isn't much more complicated in the regular expression than my solution -- and simpler in the sense that it's all done in one command. I think that your solutions are a little more fragile in that they assume a somewhat more consistent structur

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-09 Thread David Winsemius
> On Apr 9, 2016, at 11:18 AM, David Winsemius wrote: > > >> On Apr 9, 2016, at 10:46 AM, Miluji Sb wrote: >> >> Dear David, >> >> Thank you for your answer. Sorry for the embarrassing mistake. However, even >> with when I generate a map for the whole world using: >> >> eps <- mapCountryDa

[R] Quantmod abline and axis configuration

2016-04-09 Thread bgnumis bgnum
Hi all, I have this code I want to add two ablines like this abline(h=2400, lty=3, col="lightgrey") abline(h=400, lty=3, col="lightgrey") But doesnt wotk. I alo try to set ylim from 0 to max "Foa"+1000 but I´m not able ¿Is it posible? require(latticeExtra) require(ggplot2) require(reshape

Re: [R] assign

2016-04-09 Thread Georges Monette
Hi, I couldn't resist these two suggestions: strings <- c("ASk/20005-01-45/90", "Alldatk/25-17-4567/990") x <- as.numeric(gsub("^[^-]*-|-.*$","",strings)) or x <- as.numeric(sub("^[^-]*-([0-9]+)-.*$","\\1",strings)) Best, Georges - Georges Monette, York University, Toron

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-09 Thread David Winsemius
> On Apr 9, 2016, at 10:46 AM, Miluji Sb wrote: > > Dear David, > > Thank you for your answer. Sorry for the embarrassing mistake. However, even > with when I generate a map for the whole world using: > > eps <- mapCountryData(n, nameColumnToPlot="eps_score", mapTitle="EPS > Score",colourPa

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-09 Thread Miluji Sb
Dear David, Thank you for your answer. Sorry for the embarrassing mistake. However, even with when I generate a map for the whole world using: eps <- mapCountryData(n, nameColumnToPlot="eps_score", mapTitle="EPS Score",colourPalette=colourPalette, catMethod="fixedWidth", mi

Re: [R] Solution to communicating with UDP and other interfaces (under Linux) using R

2016-04-09 Thread boB Rudis
Hey Bob, If you're interested, I'd be glad to see what I can do to make doing UDP comms from R accessible across platforms without the need for a `system()` call. Mind shooting me a private e-mail to see what your needs are so I can try to generalize a solution from them? -Bob On Sat, Apr 9, 201

[R] Solution to communicating with UDP and other interfaces (under Linux) using R

2016-04-09 Thread Robert D. Bowers
I'd spent hours with Google trying to find how to control a separate software package from R via a UDP interface (I could run the package under a "system" command, but that was too slow). I finally figured out a way to communicate with UDP through R, and it works fine (using the "system" comma

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-09 Thread David Winsemius
> On Apr 9, 2016, at 8:13 AM, Miluji Sb wrote: > > Forgot to copy the list > > Dear Jim, > > Thank you for your reply. I must be doing something wrong, If this is my > command to plot a map of Europe: > > eps_europe <- mapCountryData(n, nameColumnToPlot="eps_score", mapTitle="EPS > Score - Eu

Re: [R] Arguments to utils:::menuInstallPkgs

2016-04-09 Thread Jose Claudio Faria
OK, many thanks Duncan! ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria Estatistica UESC/DCET/Brasil joseclaudio.faria at gmail.com Telefones: 55(73)3680.5545 - UESC 55(73)99966.9100 - VIVO 55(73)99100.7351 - TIM 55(73)98817.6159 - OI 55(73)98129.9942 - CLARO ///\\\///\\\///\\\

Re: [R] R.squared in summary.lm with weights

2016-04-09 Thread Martin Maechler
> Murray Efford > on Fri, 8 Apr 2016 18:45:33 + writes: > Thanks for these perfectly consistent replies - I didn't > understand the purpose of m = sum(w * f/sum(w)) and saw it > merely as a weighted average of the fitted values. My > ultimate concern is how to com

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-09 Thread Miluji Sb
Forgot to copy the list Dear Jim, Thank you for your reply. I must be doing something wrong, If this is my command to plot a map of Europe: eps_europe <- mapCountryData(n, nameColumnToPlot="eps_score", mapTitle="EPS Score - Europe",colourPalette=colourPalette, catMet

Re: [R] [FORGED] Generating random data with non-linear correlation between two variables

2016-04-09 Thread Muhammad Bilal
Hi Peter, Many thanks for the response. This is exactly what is wanted. I can now use this example to create data for my own purpose. Thanks for everybody who contributed. Warmest Regards, -- Muhammad Bilal Research Assistant and Doctoral Researcher, Bristol Enterprise, Research, and Innovat

Re: [R] [FORGED] Generating random data with non-linear correlation between two variables

2016-04-09 Thread peter dalgaard
> On 09 Apr 2016, at 13:09 , Muhammad Bilal > wrote: > > The goal is to test a developed model against two sets of hypothetical data, > where the relationship between on data set is linear whereas non-linear > (e.g., polynomial) with another. However, the distributions of the v1 and v2 > sho

Re: [R] Arguments to utils:::menuInstallPkgs

2016-04-09 Thread Duncan Murdoch
On 09/04/2016 8:14 AM, Jose Claudio Faria wrote: Dears, Is it possible (in any viable way) to pass arguments to the base function (install.packages I think) using the utils:::menu? No, but why not just call install.packages directly? (If you are using Rgui in Windows, you can add menu items

[R] Arguments to utils:::menuInstallPkgs

2016-04-09 Thread Jose Claudio Faria
Dears, Is it possible (in any viable way) to pass arguments to the base function (install.packages I think) using the utils:::menu? For example: > utils:::menuInstallPkgs(loc=.libPaths()[2]) > utils:::menuInstallLocal(loc=.libPaths()[2]) Thanks, ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\

Re: [R] [FORGED] Generating random data with non-linear correlation between two variables

2016-04-09 Thread Muhammad Bilal
By non linear correlation I mean that the trend or relationship between two variables is not a straight line. It is slightly curved like the one shared in the first replies. -- Muhammad Bilal Research Assistant and Doctoral Researcher, Bristol Enterprise, Research, and Innovation Centre (BER

Re: [R] [FORGED] Re: identical() versus sapply()

2016-04-09 Thread Duncan Murdoch
On 09/04/2016 6:27 AM, Rolf Turner wrote: On 09/04/16 16:24, Jeff Newmiller wrote: I highly recommend making friends with the str function. Try str( 1 ) str( 1:2 ) Interesting. But to me counter-intuitive. Since R makes no distinction between scalars and vectors of length 1 (or more accurat

Re: [R] [FORGED] Generating random data with non-linear correlation between two variables

2016-04-09 Thread Muhammad Bilal
The goal is to test a developed model against two sets of hypothetical data, where the relationship between on data set is linear whereas non-linear (e.g., polynomial) with another. However, the distributions of the v1 and v2 should not be other than normal or slightly positively skewed or sligh

Re: [R] [FORGED] Generating random data with non-linear correlation between two variables

2016-04-09 Thread David R Forrest
Please specify your goal in the oracle/psql analytical functions you know or specify what you mean by nonlinear correlation Sent from my iPhone > On Apr 9, 2016, at 6:09 AM, Muhammad Bilal > wrote: > > No its not. I am doing all these experiments for my own learning purpose. I > am Oracle S

Re: [R] [FORGED] Re: identical() versus sapply()

2016-04-09 Thread Rolf Turner
On 09/04/16 16:24, Jeff Newmiller wrote: I highly recommend making friends with the str function. Try str( 1 ) str( 1:2 ) Interesting. But to me counter-intuitive. Since R makes no distinction between scalars and vectors of length 1 (or more accurately I think, since in R there is *no such

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-09 Thread Jim Lemon
Hi Miluji, Try this: arrows(-100,-140,100,-140,code=3) Jim On Fri, Apr 8, 2016 at 10:24 PM, Miluji Sb wrote: > I am trying to draw maps for the world using: > > library(rworldmap) > library(maptools) > library(RColorBrewer) > > > tmp2<- dput(head(pece,10)) > structure(list(iso3 = c("AUS", "AUT

Re: [R] [FORGED] Generating random data with non-linear correlation between two variables

2016-04-09 Thread Muhammad Bilal
No its not. I am doing all these experiments for my own learning purpose. I am Oracle SQL & PLSQL programmer and I can do these things with Oracle analytical functions. However at present I am keen to learn R, with no other interest right now. Thanks -- Muhammad Bilal Research Assistant and Ph

Re: [R] [FORGED] Generating random data with non-linear correlation between two variables

2016-04-09 Thread Muhammad Bilal
Hi Rolf Turner, Firstly, I really appreciate your help. Is it possible to give the number of entries I need so that rnorm function generates only that number of rows? Also is it possible to generate the points with spread randomly such that they don't overlap each other too much. Many Thanks

Re: [R] sorting of files using system

2016-04-09 Thread Adrian Dușa
I suspect it is a problem related to locales: R and the base Ubuntu might be using different locales, hence the source of the different sorting. Can't say if this is the problem in your case, but it might be. Adrian On Sat, Apr 9, 2016 at 12:18 AM, Maria Ninova wrote: > Hello, I came across the