[R] Use of different colours in plot
Dear R list users, I have a data frame called catchment like year season rainfall colour 1953 1 409.5 black 1953 2 145.3 black 1953 3 285.6 red 1953 4 275.0 black 1954 1 273.8 black 1954 2 342.8 blue 1954 3 167.6 black 1954 4 341.1 black 1955 1 182.3 blue 1955 2 211.8 black 1955 3 222.6 black 1955 4 522.1 black 1956 1 248.7 red 1956 2 244.9 black ... and I would like to plot it with the colours specified in the column colour (at the moment the colours are three: black, red and blue. I would like to have the possibility to add oher colours to this list). With plot(catchment$year, catchment$rainfall, main=River Aso, xlab=years, ylab=mm, type=p, col=catchment$colour) the colours displayed in the graph are not the ones I have chosen. I looked for the answer, which probably involves a transformation to factor, but I am not able to understand well the solution. Could somebody help me? Thank you Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dellâart. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Model for lm keeps producing an error
Hi No reproducible example so lust general comments. 1. Your function does not return any value 2. You do not get errors but only warnings 3. In your function you get results only for X1. Is it really your intention? 4. I do not know mclapply but from quick look into help page parameters you use for your function shall be named vector or list so something like list(meth_matrix=cord_betas, exposure=filtered_pheno$Number3Mth, X1=covariates$k032, X2=covariates$k021, X3=covariates$kz029, batch=pdata.B1221.cord$BCDPlate) I would just try to use your function interactively on one item from setNames(seq_len(ncol(cord_betas)),dimnames(cord_betas)[[2]]) Do you get result? Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Jessica Timms Sent: Thursday, July 17, 2014 1:32 PM To: r-help@r-project.org Subject: [R] Model for lm keeps producing an error Hi, I still seem to be getting errors from trying to run my altered R script, any advice? Thanks Jess Model1A = function(meth_matrix,exposure, X1, X2, X3, batch) { + + mod = lm(methcol ~ exposure+X1+X2+X3+batch, data = meth_matrix) + + + res=coef(summary(mod))[2,] + + + } ##Run model1A system.time(indiv.results - mclapply(setNames(seq_len(ncol(cord_betas)), dimnames(cord_betas)[[2]]), Model1A, meth_matrix=cord_betas, exposure=filtered_pheno$Number3Mth, X1=covariates$k032, X2=covariates$k021, X3=covariates$kz029, batch=pdata.B1221.cord$BCDPlate)) user system elapsed 0.044 0.526 0.272 Warning message: In mclapply(setNames(seq_len(ncol(cord_betas)), dimnames(cord_betas)[[2]]), : all scheduled cores encountered errors in user code [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je tento e-mail součástí obchodního jednání: - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu. - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou. - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech. - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the
Re: [R] Use of different colours in plot
On Fri, 18 Jul 2014 07:07:04 AM Stefano Sofia wrote: Dear R list users, I have a data frame called catchment like year season rainfall colour 1953 1 409.5 black 1953 2 145.3 black 1953 3 285.6 red 1953 4 275.0 black 1954 1 273.8 black 1954 2 342.8 blue 1954 3 167.6 black 1954 4 341.1 black 1955 1 182.3 blue 1955 2 211.8 black 1955 3 222.6 black 1955 4 522.1 black 1956 1 248.7 red 1956 2 244.9 black ... and I would like to plot it with the colours specified in the column colour (at the moment the colours are three: black, red and blue. I would like to have the possibility to add oher colours to this list). With plot(catchment$year, catchment$rainfall, main=River Aso, xlab=years, ylab=mm, type=p, col=catchment$colour) the colours displayed in the graph are not the ones I have chosen. I looked for the answer, which probably involves a transformation to factor, but I am not able to understand well the solution. Could somebody help me? Thank you Stefano Sofia Hi Stefano, Try this: plot(catchment$year, catchment$rainfall, main=River Aso, xlab=years, ylab=mm, type=p, col=as.character(catchment$colour)) Jim __ R-help@r-project.org mailing list 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] Use of different colours in plot
Thank you Jim, perfect. Da: Jim Lemon [j...@bitwrit.com.au] Inviato: venerdì 18 luglio 2014 10.22 A: r-help@r-project.org Cc: Stefano Sofia Oggetto: Re: [R] Use of different colours in plot On Fri, 18 Jul 2014 07:07:04 AM Stefano Sofia wrote: Dear R list users, I have a data frame called catchment like year season rainfall colour 1953 1 409.5 black 1953 2 145.3 black 1953 3 285.6 red 1953 4 275.0 black 1954 1 273.8 black 1954 2 342.8 blue 1954 3 167.6 black 1954 4 341.1 black 1955 1 182.3 blue 1955 2 211.8 black 1955 3 222.6 black 1955 4 522.1 black 1956 1 248.7 red 1956 2 244.9 black ... and I would like to plot it with the colours specified in the column colour (at the moment the colours are three: black, red and blue. I would like to have the possibility to add oher colours to this list). With plot(catchment$year, catchment$rainfall, main=River Aso, xlab=years, ylab=mm, type=p, col=catchment$colour) the colours displayed in the graph are not the ones I have chosen. I looked for the answer, which probably involves a transformation to factor, but I am not able to understand well the solution. Could somebody help me? Thank you Stefano Sofia Hi Stefano, Try this: plot(catchment$year, catchment$rainfall, main=River Aso, xlab=years, ylab=mm, type=p, col=as.character(catchment$colour)) Jim AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. __ R-help@r-project.org mailing list 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] Use of different colours in plot
Em 18-07-2014 08:07, Stefano Sofia escreveu: Dear R list users, I have a data frame called catchment like year season rainfall colour 1953 1 409.5 black 1953 2 145.3 black 1953 3 285.6 red 1953 4 275.0 black 1954 1 273.8 black 1954 2 342.8 blue 1954 3 167.6 black 1954 4 341.1 black 1955 1 182.3 blue 1955 2 211.8 black 1955 3 222.6 black 1955 4 522.1 black 1956 1 248.7 red 1956 2 244.9 black ... and I would like to plot it with the colours specified in the column colour (at the moment the colours are three: black, red and blue. I would like to have the possibility to add oher colours to this list). With plot(catchment$year, catchment$rainfall, main=River Aso, xlab=years, ylab=mm, type=p, col=catchment$colour) the colours displayed in the graph are not the ones I have chosen. I looked for the answer, which probably involves a transformation to factor, but I am not able to understand well the solution. Could somebody help me? Thank you Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. did you try the palette() function? you can define a new like: palette(c(black,red,blue)) then you can call the colors by numbers (1,2,3) replace the color name in the column by the respective 1,2,3 numbers ant give a try. I haven't try it, but it's the natural way I can think of. | | -- João Azevedo Patrício Tel.: +31 91 400 53 63 Portugal @ http://tripaforra.bl.ee Take 2 seconds to think before you act __ R-help@r-project.org mailing list 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] QR code?
Is there an R function to convert text to a QR Code? My search attempts yielded QR decompositions ;-) Thanks, Spencer __ R-help@r-project.org mailing list 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] Vector of Numbers Not Output to Screen
On 18/07/14 15:00, Dario Strbenac wrote: The example in the question was not inside a user function. Don't be silly. cheers, Rolf Turner -- Rolf Turner Technical Editor ANZJS __ R-help@r-project.org mailing list 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] Reading SDMX Files in R
Dear Lorenzo, I've just seen one post from you asking for hints to read SDMX data in R. I don't know if you still need to read SDMX datasets in R. In case, you can use the rsdmx package hosted here https://github.com/opensdmx/rsdmx With the OECD sample you mention, you can do as follows: #install devtools (required to install rsdmx from github)||| |require(devtools) | #install load rsdmx install_github(rsdmx, opensdmx)| require(rsdmx) #read data sdmx - readSDMX(http://stats.oecd.org/restsdmx/sdmx.ashx/GetData/MSTI_PUB/G_XGDP.AUS+AUT+BEL+CAN+CHL+CZE+DNK+EST+FIN+FRA+DEU+GRC+HUN+ISL+IRL+ISR+ITA+JPN+KOR+LUX+MEX+NLD+NZL+NOR+POL+PRT+SVK+SVN+ESP+SWE+CHE+TUR+GBR+USA+OECD+EU28+EU15+NMEC+ARG+CHN+ROU+RUS+SGP+ZAF+TWN/OECD?startTime=2000endTime=2014;) df - as.data.frame(sdmx) You can look at the wiki that gives some more information https://github.com/opensdmx/rsdmx/wiki Hope this helps, Emmanuel http://fr.linkedin.com/in/emmanuelblondel1 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] modifications for ONLY local repository?
Hello, We are in the midst of changing our SOP for R on our local cluster. Network access is only available from the head node but we don't want users downloading and compiling packages on the head node. Previously, we asked that all package installations updates be done by the admins on request but this is unsustainable. We've decided to internally mirror both CRAN and Bioconductor and keep a core of the most used packages on R_HOME/library and update those weekly. Users can also download/install/update other packages from CRAN/Bioconductor using their own local library. What we are trying to work out now are the system settings needed so that install.packages (and eventually biocLite) automatically point to only our internal mirrors without having specify them in the repos argument. After much googling, I think I've figured out that we need to set up a ~R/etc/Rprofile.site file to change the default CRAN repository to our local site using options(repos = c(CRAN = file:home! /mirrors/no_backup/cran). Is this all that is needed or do we also need to modify ~R/etc/repositories, changing the URL locations to our local ones and commenting out the other repositories? Anything else we need to do to get install.packages(ape) to work seamlessly for the end user? We want to make it so that only users who really know what they are doing can get around installing from the local mirrors, even if they are accidentally running on the head node. Thanks for any help or suggestions, Jenny Jenny Drnevich, Ph.D. Functional Genomics Bioinformatics Specialist High Performance Biological Computing Program and The Roy J. Carver Biotechnology Center University of Illinois, Urbana-Champaign NOTE NEW OFFICE LOCATION 2112 IGB 1206 W. Gregory Dr. Urbana, IL 61801 USA ph: 217-300-6543 fax: 217-265-5066 e-mail: drnev...@illinois.edumailto:drnev...@illinois.edu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 with script to get starting date of blooms
Hi list I have a vector, which are remotely sensed chlorophyll values for a certain pixel in 11 years, then i have a flag or label vector (t_max) that consists of 0 and 1, which tells me where i have the annual peak (one per year, then eleven 1 and all the rest are 0). I'm interested in extracting the date in which the bloom beggins. For that matter I'm using a threshold of 5% above the median of the whole series. I need to go over the chlorophyll data vector (cla) and every time I find the yearly maximum value (where t_max == 1), i need to go backwards in cla as many time steps as needed untill I cross the threshold (5% over the median of cl)... once i crossed that threshold, i need to be sure that at least for 2 time steps, the value of cla keeps going down (it's below the threshold)... once that condition is met, i want to get the first position where cla is higher than that threshold... that would be the phytoplankton bloom starting date... This is more or less what i was trying, but it does not work and i'm stuck... can you please help me?? cla- ts of 506 values (every 46 values, i have one year) t_max- vector of 0 1; 1 where the yearly cla max occurs (11 ones all rest 0) threshold = 0.05*median(cla)+median(cla) for ( t in 1:length(t_max) ) { if ( t_max[t] == 0 ) { next; } else { if ( (cla[t-1] threshold) (cla[t-2)] threshold) ) { return which(cla[t]) } } } Thanks a lot in advance!! :) Vero [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Problem with residualPlots with type rstudent
I am trying to apply the following command in R Studio but it is giving me error. Can you please leet me know why it is not working with R Studio? residualPlots(our.lm, type=rstudent) Error in match.arg(type) : 'arg' should be one of âworkingâ, âresponseâ, âdevianceâ, âpearsonâ, âpartialâ Thanks, Dogar -- -- This message and its contents, including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] String comparison, trailing blanks make a difference.
Well, this was a shock to me. And I don't really see any documentation about it, but perhaps I just can't see it. abc == abc [1] FALSE I guess that I thought of strings in R like I do is some other languages where the shorter value is padded with blanks to the length of the longer value, then compared. I.e. that trailing blanks didn't matter. The best solution that I have found is to use the str_trim() function from the stringr to remove all the trailing blanks after I get the data from the SQL data base. I cannot change the SQL schema to make the column a varchar instead of a char column. It is a vendor DB. And I don't know an ANSI SQL standard way to remove trailing blanks in the SELECT command. PostgreSQL has a trim(trailing ' ' from column)', but MS-SQL upchucks on that syntax. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown __ R-help@r-project.org mailing list 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] String comparison, trailing blanks make a difference.
abc == abc [1] FALSE R does no interpretation of strings when doing comparisons so you do have do your own canonicalization. That may involve removing trailing, leading, or all white space or punctuation, converting to lower or upper case, mapping nicknames to official names, trimming to a fixed number of characters, etc. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jul 18, 2014 at 9:17 AM, John McKown john.archie.mck...@gmail.com wrote: Well, this was a shock to me. And I don't really see any documentation about it, but perhaps I just can't see it. abc == abc [1] FALSE I guess that I thought of strings in R like I do is some other languages where the shorter value is padded with blanks to the length of the longer value, then compared. I.e. that trailing blanks didn't matter. The best solution that I have found is to use the str_trim() function from the stringr to remove all the trailing blanks after I get the data from the SQL data base. I cannot change the SQL schema to make the column a varchar instead of a char column. It is a vendor DB. And I don't know an ANSI SQL standard way to remove trailing blanks in the SELECT command. PostgreSQL has a trim(trailing ' ' from column)', but MS-SQL upchucks on that syntax. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown __ R-help@r-project.org mailing list 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 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] String comparison, trailing blanks make a difference.
Hi John, On 07/18/2014 09:17 AM, John McKown wrote: Well, this was a shock to me. And I don't really see any documentation about it, but perhaps I just can't see it. abc == abc [1] FALSE I guess that I thought of strings in R like I do is some other languages where the shorter value is padded with blanks to the length of the longer value, then compared. I.e. that trailing blanks didn't matter. The shock to me is to learn that some programming languages consider strings abc and abc to be the same. Please name them so I can stay away from them ;-) Thanks, H. The best solution that I have found is to use the str_trim() function from the stringr to remove all the trailing blanks after I get the data from the SQL data base. I cannot change the SQL schema to make the column a varchar instead of a char column. It is a vendor DB. And I don't know an ANSI SQL standard way to remove trailing blanks in the SELECT command. PostgreSQL has a trim(trailing ' ' from column)', but MS-SQL upchucks on that syntax. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpa...@fhcrc.org Phone: (206) 667-5791 Fax:(206) 667-1319 __ R-help@r-project.org mailing list 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] understanding the parameters of 'spca' function of 'elasticnet' package
Hi all, i am trying to use the 'spca' function of 'elasticnet' package. But i am confused with the parameter 'para'. Basically the parameter 'para' depends on the parameter 'sparse'. If sparse=penalty, para is a vector of 1-norm penalty parameters. If sparse=varnum, para defines the number of sparse loadings to be obtained. As my understanding, if i use sparse=penalty i have to set the amount of variance for each component in a vector. But how could i know the amount of variance in this case? If i use sparse='varnum', i have to set the number of features i want to extract from each component in a vector. But i dont have these numbers even because i dont know how many key features are present in each component. Thanks __ R-help@r-project.org mailing list 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] Problem in installing package ggplot2
Hi.. After I upgraded R from 3.1 to 3.11, I stuck with problem in installing 'ggplot2' package The error message was; Error in loadNamespace(j - i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called âRcppâ Error: package or namespace load failed for âggplot2â I tried to find out resolution on the web.. and most people recommend following; install.packages(ggplot2,dependencies=T) However, it didn't work, either.. it's so confusing. I should use this package ASAP.. so, hope you guys give me a clear answer. Best for your effort, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Problem in installing package ggplot2
install.packages(ggplot2,dependencies=T) However, it didn't work, either.. it's so confusing. What does R print when you type the 2 lines install.packages(ggplot2, dependencies=TRUE) libraray(ggplot2) ? (didn't work covers a lot of ground - seeing the entire printed output may tell others what is going on.) Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jul 18, 2014 at 10:12 AM, 오건희 gunfif...@gmail.com wrote: Hi.. After I upgraded R from 3.1 to 3.11, I stuck with problem in installing 'ggplot2' package The error message was; Error in loadNamespace(j - i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘Rcpp’ Error: package or namespace load failed for ‘ggplot2’ I tried to find out resolution on the web.. and most people recommend following; install.packages(ggplot2,dependencies=T) However, it didn't work, either.. it's so confusing. I should use this package ASAP.. so, hope you guys give me a clear answer. Best for your effort, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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] Problem in installing package ggplot2
The obvious workaround (to me) is to go back and use 3.1 until you figure out how to setup 3.1.1. Re the latter... you have omitted some key information that strongly suggests that you have not read the Posting Guide. You might find reading [1] helpful as well. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On July 18, 2014 10:12:19 AM PDT, 오건희 gunfif...@gmail.com wrote: Hi.. After I upgraded R from 3.1 to 3.11, I stuck with problem in installing 'ggplot2' package The error message was; Error in loadNamespace(j - i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ���Rcpp��� Error: package or namespace load failed for ���ggplot2��� I tried to find out resolution on the web.. and most people recommend following; install.packages(ggplot2,dependencies=T) However, it didn't work, either.. it's so confusing. I should use this package ASAP.. so, hope you guys give me a clear answer. Best for your effort, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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] Fwd: Plot the means with simultaneous horizontal and vertical error bars
Dear R users, I would appreciate your help in plotting the means with simultaneous horizontal and vertical error bars. I use the lineplot.CI but it creates the vertical bars only. The attached file has the dataset that I want to graph. The (X) is the x-axis values and (y Lint) is the response in y-axis. Therefore, values in the x-axis would be 150, 350, 550, .etc. At each value of the x-axis would be the average response point (y Lint) with vertical and horizontal error bars. Each value of the x-axis (X) represents a range of values that in x Water. The x Water column should be used to draw the horizontal lines. Thank you so much. AA Ahmed M. Attia Research Assistant Dept. of SoilCrop Sciences Texas AM University ahmed.at...@ag.tamu.edu Cell phone: 001-979-248-5215 FAX: 001-308-455-4024 __ R-help@r-project.org mailing list 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] Fwd: Plot the means with simultaneous horizontal and vertical error bars
You could try plotCI from the plotrix package. Note that most attachments are stripped; dput() is the preferred way to include data. Sarah On Fri, Jul 18, 2014 at 4:41 PM, Ahmed Attia ahmedati...@gmail.com wrote: Dear R users, I would appreciate your help in plotting the means with simultaneous horizontal and vertical error bars. I use the lineplot.CI but it creates the vertical bars only. The attached file has the dataset that I want to graph. The (X) is the x-axis values and (y Lint) is the response in y-axis. Therefore, values in the x-axis would be 150, 350, 550, .etc. At each value of the x-axis would be the average response point (y Lint) with vertical and horizontal error bars. Each value of the x-axis (X) represents a range of values that in x Water. The x Water column should be used to draw the horizontal lines. Thank you so much. AA -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list 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] setting axis limits and breaks in ggplot2
Hello! I want my y axis in this plot to range from 0 to 1 and use as break points 0, 0.1, 0.2 up to 1. Why is my code below not working? Thank you! library(ggplot2) test-data.frame(a=1:4,b=c(0.12,0.5,0.6,0.4)) ggplot(test, aes(x=a, y=b))+geom_line()+ scale_x_continuous(breaks=1:4)+ scale_y_continuous(breaks=seq(0,1,by=0.1)) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] setting axis limits and breaks in ggplot2
You need to explicitly specify the limits; see http://docs.ggplot2.org/current/scale_continuous.html library(ggplot2) test-data.frame(a=1:4,b=c(0.12,0.5,0.6,0.4)) ggplot(test, aes(x=a, y=b))+geom_line()+ scale_x_continuous(breaks=1:4)+ scale_y_continuous(breaks=seq(0,1,by=0.1), limits=c(0,1)) Sarah On Fri, Jul 18, 2014 at 5:04 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I want my y axis in this plot to range from 0 to 1 and use as break points 0, 0.1, 0.2 up to 1. Why is my code below not working? Thank you! library(ggplot2) test-data.frame(a=1:4,b=c(0.12,0.5,0.6,0.4)) ggplot(test, aes(x=a, y=b))+geom_line()+ scale_x_continuous(breaks=1:4)+ scale_y_continuous(breaks=seq(0,1,by=0.1)) -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list 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] setting axis limits and breaks in ggplot2
Thank you very much, Sarah! On Fri, Jul 18, 2014 at 5:18 PM, Sarah Goslee sarah.gos...@gmail.com wrote: You need to explicitly specify the limits; see http://docs.ggplot2.org/current/scale_continuous.html library(ggplot2) test-data.frame(a=1:4,b=c(0.12,0.5,0.6,0.4)) ggplot(test, aes(x=a, y=b))+geom_line()+ scale_x_continuous(breaks=1:4)+ scale_y_continuous(breaks=seq(0,1,by=0.1), limits=c(0,1)) Sarah On Fri, Jul 18, 2014 at 5:04 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I want my y axis in this plot to range from 0 to 1 and use as break points 0, 0.1, 0.2 up to 1. Why is my code below not working? Thank you! library(ggplot2) test-data.frame(a=1:4,b=c(0.12,0.5,0.6,0.4)) ggplot(test, aes(x=a, y=b))+geom_line()+ scale_x_continuous(breaks=1:4)+ scale_y_continuous(breaks=seq(0,1,by=0.1)) -- Sarah Goslee http://www.functionaldiversity.org -- Dimitri Liakhovitski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Fwd: Plot the means with simultaneous horizontal and vertical error bars
Did you read the help? err: The direction of error bars: x for horizontal, y for vertical (xy would be nice but is not implemented yet; don't know quite how everything would be specified. See examples for composing a plot with simultaneous horizontal and vertical error bars) Sarah On Fri, Jul 18, 2014 at 5:22 PM, Ahmed Attia ahmedati...@gmail.com wrote: Sarah, PlotCI provides the vertical CI bars only. Do you have any idea? plotCI(x=means, uiw=ciw) # prettier plotCI(x=means, uiw=ciw, col=black, barcol=blue, lwd=1) AA Ahmed M. Attia Research Assistant Dept. of SoilCrop Sciences Texas AM University ahmed.at...@ag.tamu.edu Cell phone: 001-979-248-5215 FAX: 001-308-455-4024 On Fri, Jul 18, 2014 at 4:00 PM, Sarah Goslee sarah.gos...@gmail.com wrote: You could try plotCI from the plotrix package. Note that most attachments are stripped; dput() is the preferred way to include data. Sarah On Fri, Jul 18, 2014 at 4:41 PM, Ahmed Attia ahmedati...@gmail.com wrote: Dear R users, I would appreciate your help in plotting the means with simultaneous horizontal and vertical error bars. I use the lineplot.CI but it creates the vertical bars only. The attached file has the dataset that I want to graph. The (X) is the x-axis values and (y Lint) is the response in y-axis. Therefore, values in the x-axis would be 150, 350, 550, .etc. At each value of the x-axis would be the average response point (y Lint) with vertical and horizontal error bars. Each value of the x-axis (X) represents a range of values that in x Water. The x Water column should be used to draw the horizontal lines. Thank you so much. AA -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list 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] Fwd: Plot the means with simultaneous horizontal and vertical error bars
On Fri, Jul 18, 2014 at 5:38 PM, Ahmed Attia ahmedati...@gmail.com wrote: Yes, I saw this but I can't translate it to a code. http://svitsrv25.epfl.ch/R-doc/library/Hmisc/html/errbar.html Why are you reading the help for Hmisc::errbar when I suggested (and copied and pasted for you!) the function plotCI from the plotrix package? The examples in ?plotCI demonstrate having horizontal and vertical error bars, as cited in the bit I copied and pasted for you. Please also reply all so your message returns to the R-help list, and not just to me, so others can participate and benefit. Sarah I looked at this but it produces the vertical bars only. AA Ahmed M. Attia Research Assistant Dept. of SoilCrop Sciences Texas AM University ahmed.at...@ag.tamu.edu Cell phone: 001-979-248-5215 FAX: 001-308-455-4024 On Fri, Jul 18, 2014 at 4:29 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Did you read the help? err: The direction of error bars: x for horizontal, y for vertical (xy would be nice but is not implemented yet; don't know quite how everything would be specified. See examples for composing a plot with simultaneous horizontal and vertical error bars) Sarah On Fri, Jul 18, 2014 at 5:22 PM, Ahmed Attia ahmedati...@gmail.com wrote: Sarah, PlotCI provides the vertical CI bars only. Do you have any idea? plotCI(x=means, uiw=ciw) # prettier plotCI(x=means, uiw=ciw, col=black, barcol=blue, lwd=1) AA Ahmed M. Attia Research Assistant Dept. of SoilCrop Sciences Texas AM University ahmed.at...@ag.tamu.edu Cell phone: 001-979-248-5215 FAX: 001-308-455-4024 On Fri, Jul 18, 2014 at 4:00 PM, Sarah Goslee sarah.gos...@gmail.com wrote: You could try plotCI from the plotrix package. Note that most attachments are stripped; dput() is the preferred way to include data. Sarah On Fri, Jul 18, 2014 at 4:41 PM, Ahmed Attia ahmedati...@gmail.com wrote: Dear R users, I would appreciate your help in plotting the means with simultaneous horizontal and vertical error bars. I use the lineplot.CI but it creates the vertical bars only. The attached file has the dataset that I want to graph. The (X) is the x-axis values and (y Lint) is the response in y-axis. Therefore, values in the x-axis would be 150, 350, 550, .etc. At each value of the x-axis would be the average response point (y Lint) with vertical and horizontal error bars. Each value of the x-axis (X) represents a range of values that in x Water. The x Water column should be used to draw the horizontal lines. Thank you so much. AA -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list 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] Fwd: Plot the means with simultaneous horizontal and vertical error bars
Hi all, I have been also trying the plotCI but it did not work out plotCI(x, y = NULL, uiw, liw = uiw, ui, li, err='y', ylim=NULL, xlim=NULL, type=p, col=par(col), barcol=col, pt.bg = par(bg), sfrac = 0.01, gap=1, lwd=par(lwd), lty=par(lty), labels=FALSE, add=FALSE, xlab, ylab, minbar, maxbar, ... ) I searched and looked at the previous plotCI posts below; http://www.talkstats.com/showthread.php/51908-Vertical-and-horizontal-error-bars-PlotCI-errbar Dear R users, I would appreciate your help in plotting the means with simultaneous horizontal and vertical error bars. I use the lineplot.CI but it creates the vertical bars only. The attached file has the dataset that I want to graph. The (X) is the x-axis values and (y Lint) is the response in y-axis. Therefore, values in the x-axis would be 150, 350, 550, .etc. At each value of the x-axis would be the average response point (y Lint) with vertical and horizontal error bars. Each value of the x-axis (X) represents a range of values that in x Water. The x Water column should be used to draw the horizontal lines. Thank you so much. AA Ahmed M. Attia Research Assistant Dept. of SoilCrop Sciences Texas AM University ahmed.at...@ag.tamu.edu Cell phone: 001-979-248-5215 FAX: 001-308-455-4024 __ R-help@r-project.org mailing list 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] Fwd: Plot the means with simultaneous horizontal and vertical error bars
The example given in ?plotCI works just fine for me. You'll need to be more specific about what isn't working, and ideally provide some data with dput(). Notice the add=TRUE argument in the second call to plotCI(). y-runif(10) err.x-runif(10) err.y-runif(10) plotCI(1:10,y,err.y,pt.bg=par(bg),pch=21,xlim=c(0,11), main=plotCI with extra space on the x axis) plotCI(1:10,y,err.x,pt.bg=par(bg),pch=21,err=x,add=TRUE) Sarah On Fri, Jul 18, 2014 at 6:06 PM, Ahmed Attia ahmedati...@gmail.com wrote: Hi all, I have been also trying the plotCI but it did not work out plotCI(x, y = NULL, uiw, liw = uiw, ui, li, err='y', ylim=NULL, xlim=NULL, type=p, col=par(col), barcol=col, pt.bg = par(bg), sfrac = 0.01, gap=1, lwd=par(lwd), lty=par(lty), labels=FALSE, add=FALSE, xlab, ylab, minbar, maxbar, ... ) I searched and looked at the previous plotCI posts below; http://www.talkstats.com/showthread.php/51908-Vertical-and-horizontal-error-bars-PlotCI-errbar Dear R users, I would appreciate your help in plotting the means with simultaneous horizontal and vertical error bars. I use the lineplot.CI but it creates the vertical bars only. The attached file has the dataset that I want to graph. The (X) is the x-axis values and (y Lint) is the response in y-axis. Therefore, values in the x-axis would be 150, 350, 550, .etc. At each value of the x-axis would be the average response point (y Lint) with vertical and horizontal error bars. Each value of the x-axis (X) represents a range of values that in x Water. The x Water column should be used to draw the horizontal lines. Thank you so much. AA Ahmed M. Attia __ R-help@r-project.org mailing list 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] Fwd: Plot the means with simultaneous horizontal and vertical error bars
Is the original poster having trouble translating the synopsis at the top of the help file to actual code? He should look at the examples at the bottom of the help file, or better, run them with example(plotCI) and see if any of the plots looks close to what he wants. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jul 18, 2014 at 3:15 PM, Sarah Goslee sarah.gos...@gmail.com wrote: The example given in ?plotCI works just fine for me. You'll need to be more specific about what isn't working, and ideally provide some data with dput(). Notice the add=TRUE argument in the second call to plotCI(). y-runif(10) err.x-runif(10) err.y-runif(10) plotCI(1:10,y,err.y,pt.bg=par(bg),pch=21,xlim=c(0,11), main=plotCI with extra space on the x axis) plotCI(1:10,y,err.x,pt.bg=par(bg),pch=21,err=x,add=TRUE) Sarah On Fri, Jul 18, 2014 at 6:06 PM, Ahmed Attia ahmedati...@gmail.com wrote: Hi all, I have been also trying the plotCI but it did not work out plotCI(x, y = NULL, uiw, liw = uiw, ui, li, err='y', ylim=NULL, xlim=NULL, type=p, col=par(col), barcol=col, pt.bg = par(bg), sfrac = 0.01, gap=1, lwd=par(lwd), lty=par(lty), labels=FALSE, add=FALSE, xlab, ylab, minbar, maxbar, ... ) I searched and looked at the previous plotCI posts below; http://www.talkstats.com/showthread.php/51908-Vertical-and-horizontal-error-bars-PlotCI-errbar Dear R users, I would appreciate your help in plotting the means with simultaneous horizontal and vertical error bars. I use the lineplot.CI but it creates the vertical bars only. The attached file has the dataset that I want to graph. The (X) is the x-axis values and (y Lint) is the response in y-axis. Therefore, values in the x-axis would be 150, 350, 550, .etc. At each value of the x-axis would be the average response point (y Lint) with vertical and horizontal error bars. Each value of the x-axis (X) represents a range of values that in x Water. The x Water column should be used to draw the horizontal lines. Thank you so much. AA Ahmed M. Attia __ R-help@r-project.org mailing list 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 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] Weird but interesting behavior of ggplot2 in a loop
Hello and sorry I am not providing an example. However, I hope you'll be able to answer my question. I have a for loop. Inside this loop I build 4 plots using ggplot2. See 2 blocks of code below - I have in total 4 of those: As I step through the loop manually and run all the code inside the loop, everything works perfectly and R generates (among other things) 4 .png files in my working directory (each size 7 KB). However, when I run the loop (even when the loop length is 1) the generated .png files are empty (and size 1 KB). I've never seen anything like this. My loop is correct - because everything else generated in the loop except for the images is there. And the image files with right names are also there, they are just empty. Any ideas why this might be happening? I did it first in RStudio and then just in R Gui. Thank you very much! png(forname1,width=700,height=450) ggplot(result.opt, aes(x=prices, y=demand))+ geom_line(colour='darkblue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Purchase Intent)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() png(forname2,width=700,height=450) ggplot(result.opt, aes(x=prices, y=revenue))+ geom_line(colour='blue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ # scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Revenue per Person)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() -- Dimitri Liakhovitski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Weird but interesting behavior of ggplot2 in a loop
Inside a loop or other function you need an explicit print statement. http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f Sarah On Friday, July 18, 2014, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello and sorry I am not providing an example. However, I hope you'll be able to answer my question. I have a for loop. Inside this loop I build 4 plots using ggplot2. See 2 blocks of code below - I have in total 4 of those: As I step through the loop manually and run all the code inside the loop, everything works perfectly and R generates (among other things) 4 .png files in my working directory (each size 7 KB). However, when I run the loop (even when the loop length is 1) the generated .png files are empty (and size 1 KB). I've never seen anything like this. My loop is correct - because everything else generated in the loop except for the images is there. And the image files with right names are also there, they are just empty. Any ideas why this might be happening? I did it first in RStudio and then just in R Gui. Thank you very much! png(forname1,width=700,height=450) ggplot(result.opt, aes(x=prices, y=demand))+ geom_line(colour='darkblue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Purchase Intent)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() png(forname2,width=700,height=450) ggplot(result.opt, aes(x=prices, y=revenue))+ geom_line(colour='blue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ # scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Revenue per Person)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() -- Dimitri Liakhovitski [[alternative HTML version deleted]] __ R-help@r-project.org javascript:; mailing list 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. -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Weird but interesting behavior of ggplot2 in a loop
Thank you, but if I give my plot a name and then print it, how can I print it with a desired name? png(forname1,width=700,height=450) print( ggplot(result.opt, aes(x=prices, y=demand))+ geom_line(colour='darkblue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Purchase Intent)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) ) dev.off() On Fri, Jul 18, 2014 at 6:53 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Inside a loop or other function you need an explicit print statement. http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f Sarah On Friday, July 18, 2014, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello and sorry I am not providing an example. However, I hope you'll be able to answer my question. I have a for loop. Inside this loop I build 4 plots using ggplot2. See 2 blocks of code below - I have in total 4 of those: As I step through the loop manually and run all the code inside the loop, everything works perfectly and R generates (among other things) 4 .png files in my working directory (each size 7 KB). However, when I run the loop (even when the loop length is 1) the generated .png files are empty (and size 1 KB). I've never seen anything like this. My loop is correct - because everything else generated in the loop except for the images is there. And the image files with right names are also there, they are just empty. Any ideas why this might be happening? I did it first in RStudio and then just in R Gui. Thank you very much! png(forname1,width=700,height=450) ggplot(result.opt, aes(x=prices, y=demand))+ geom_line(colour='darkblue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Purchase Intent)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() png(forname2,width=700,height=450) ggplot(result.opt, aes(x=prices, y=revenue))+ geom_line(colour='blue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ # scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Revenue per Person)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() -- Dimitri Liakhovitski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org -- Dimitri Liakhovitski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Weird but interesting behavior of ggplot2 in a loop
I meant - the code I just sent doesn't give the file being printed a name... On Fri, Jul 18, 2014 at 7:05 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thank you, but if I give my plot a name and then print it, how can I print it with a desired name? png(forname1,width=700,height=450) print( ggplot(result.opt, aes(x=prices, y=demand))+ geom_line(colour='darkblue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Purchase Intent)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) ) dev.off() On Fri, Jul 18, 2014 at 6:53 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Inside a loop or other function you need an explicit print statement. http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f Sarah On Friday, July 18, 2014, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello and sorry I am not providing an example. However, I hope you'll be able to answer my question. I have a for loop. Inside this loop I build 4 plots using ggplot2. See 2 blocks of code below - I have in total 4 of those: As I step through the loop manually and run all the code inside the loop, everything works perfectly and R generates (among other things) 4 .png files in my working directory (each size 7 KB). However, when I run the loop (even when the loop length is 1) the generated .png files are empty (and size 1 KB). I've never seen anything like this. My loop is correct - because everything else generated in the loop except for the images is there. And the image files with right names are also there, they are just empty. Any ideas why this might be happening? I did it first in RStudio and then just in R Gui. Thank you very much! png(forname1,width=700,height=450) ggplot(result.opt, aes(x=prices, y=demand))+ geom_line(colour='darkblue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Purchase Intent)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() png(forname2,width=700,height=450) ggplot(result.opt, aes(x=prices, y=revenue))+ geom_line(colour='blue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ # scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Revenue per Person)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() -- Dimitri Liakhovitski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org -- Dimitri Liakhovitski -- Dimitri Liakhovitski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Weird but interesting behavior of ggplot2 in a loop
FAQ 7.16. ... yes, it applies. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On July 18, 2014 3:42:14 PM PDT, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello and sorry I am not providing an example. However, I hope you'll be able to answer my question. I have a for loop. Inside this loop I build 4 plots using ggplot2. See 2 blocks of code below - I have in total 4 of those: As I step through the loop manually and run all the code inside the loop, everything works perfectly and R generates (among other things) 4 .png files in my working directory (each size 7 KB). However, when I run the loop (even when the loop length is 1) the generated .png files are empty (and size 1 KB). I've never seen anything like this. My loop is correct - because everything else generated in the loop except for the images is there. And the image files with right names are also there, they are just empty. Any ideas why this might be happening? I did it first in RStudio and then just in R Gui. Thank you very much! png(forname1,width=700,height=450) ggplot(result.opt, aes(x=prices, y=demand))+ geom_line(colour='darkblue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Purchase Intent)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() png(forname2,width=700,height=450) ggplot(result.opt, aes(x=prices, y=revenue))+ geom_line(colour='blue',size=1.2)+ scale_x_continuous(breaks=seq(input[1,1],input[nrow(input),1],by=step*6))+ # scale_y_continuous(breaks=seq(0,1,by=0.1),limits=c(0,1))+ xlab(Price) + ylab(Revenue per Person)+ labs(title=forname2)+ theme(plot.title = element_text(size=16))+ theme(axis.title.x=element_text(size=12))+ theme(axis.title.y=element_text(size=12)) dev.off() __ R-help@r-project.org mailing list 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] Fwd: Plot the means with simultaneous horizontal and vertical error bars
My problem is getting x and y into the PlotCI. I do not know how to use the dput(). But below is my data; x x-Water y 150 74.67 75 150 92.2 97 150 138.2 327.5 150 140.2 142.6 150 194.82 333.8 150 226.31 423 150 226.56 590.9 150 240.28 546.6 150 241.55 232.3 150 243.07 454.6 350 252.7 352.8 350 257.4 459.7 350 260.09 874.2 350 260.5 272.8 350 270.25 359.8 350 272.54 1008 350 286 638.9 350 288.3 791 350 288.54 736 350 291.34 816.3 350 297.0 465 350 303.8 234.3 350 306.58 601.9 350 310.38 942.9 350 311.3 334.4 350 317.75 522.1 350 330.45 563 350 333.78 717.4 350 339.59 851.5 350 341.37 642 350 342.7 490.5 350 344.2 487.7 350 344.42 1174 350 345.4 440.7 350 345.44 243 350 349.22 834.8 350 354.48 704.9 350 363.4 885 350 365.75 606.7 350 366.77 1036.9 350 370.08 898.8 350 371.09 640.9 350 372.69 768.1 350 374.24 574.4 350 375.15 200.9 350 375.3 1217 350 376.17 836.4 350 377.7 949.8 350 377.7 986.9 350 382.74 458.6 350 384 456.4 350 384.3 1189 350 385.9 978.2 350 388.44 379.7 350 391.66 865.7 350 392.44 1026.8 350 394.3 663.7 350 398.74 533.1 350 399.72 551.6 350 402.33 341.3 350 410.4 889 350 413 1530 350 419.35 1109.8 350 421.19 802.1 350 422.4 896.8 350 422.65 995.6 350 428.49 1337 350 433.72 1304.6 350 439.2 1190.4 350 439.42 914.3 350 440.43 1016.9 350 443 1266.1 350 446.4 659.3 350 448.05 369.3 550 455.34 1206.2 550 456.44 1139.9 550 458.45 1541.1 550 461.52 1048.4 550 461.77 486 550 462.45 910.6 550 467.49 1257 550 470.15 880.1 550 471.2 1155.7 550 471.32 1275 550 475.22 570.4 550 475.48 1226.6 550 481.58 1520 550 484.52 1549.6 550 488.29 1298 550 488.73 887.1 550 490.98 1261 550 491.08 1519.5 550 492.76 1082.6 550 499.38 1339.3 550 501.31 1121.3 550 503.42 1216.8 550 503.87 723.6 550 505.71 1488.6 550 506.74 1613.1 550 510.77 1460.9 550 514.09 1207.1 550 518.72 1167.771 550 519.93 1485.1 550 523.09 1025.8 550 526.79 986.5 550 530.34 874.5 550 532.89 1408.8 550 534.16 1197.7 550 538.1 1235.1 550 542.06 1219.7 550 545.34 1176.2 550 548.89 1366.4 550 550.668 1248 550 551.0 1434.4 550 551.84 1092.1 550 552.95 766.5 550 553.68 1465.7 550 556.76 1311.6 550 557.59 1247.3 550 558 1288.3 550 558.23 1115.257 550 567.66 1514.2 550 571.75 1249.9 550 571.82 1320 550 572.8 1397.2 550 577.89 1228 550 578 1580.1 550 578.5 1491.3 550 582.67 1304.3 550 587.75 1188.7 550 590.14 1476.8 550 592.07 1644.1 550 592.1 1334.4 550 596.9 1395.7 550 600.2 1468 550 602.76 978.3 550 604.01 1183.5 550 604.57 1051.49 550 608.98 1408.4 550 610.875 1189.9 550 616.45 1647.9 550 620.7 1193.3 550 623.58 1804 550 626.6 1575.8 550 629.16 1187.8 550 635.25 1468.2 550 638.34 1276 550 640.32 982.4 550 641 1241.3 550 647.5 1452.4 550 649.24 1826.5 750 653.56 1613.7 750 660.36 1731 750 665.22 1271.6 750 665.92 1172.369 750 669.03 1403.9 750 669.03 1261 750 669.94 1582.7 750 671.6 1296.4 750 673.35 1280.7 750 675.85 1306.8 750 678.43 1697.6 750 679.42 1435.1 750 679.48 1315.4 750 682.49 930.7 750 684.68 1612.1 750 685.29 1328.3 750 702.74 .3 750 704.58 980.6 750 712.97 1766.4 750 713.996 1163.7 750 714.4 1458 750 715.14 1238 750 717.14 1553.6 750 718.82 1653.9 750 720.55 1343.4 750 729.06 1053.063 750 730.754 1132 750 742.0 1293.2 750 755.87 1564.7 750 757.42 1211.7 750 764.03 1420.6 750 765.25 1449.4 750 766.08 1839 750 768.09 1579.1 750 769 1546.7 750 772.17 1779.6 750 772.41 1193.6 750 777.2 1880.7 750 783.62 1558.8 750 785.9 1259.4 750 788.64 1363.6 750 790.09 1398.4 750 793.22 1157.607 750 805.67 1135 750 808.99 1617.3 750 812.03 1246.4 750 820.672 1362 750 831.4 1586 750 842.51 1362.5 750 852.18 1597 950 852.18 1597 950 861.03 1554.4 950 865.26 1358.2 950 870.926 1713 950 872.74 1191.2 950 878.83 1544.1 950 895.62 1651.7 950 896.59 1233.2 950 901.22 1209.8 950 935.58 1278.7 950 944.11 1215.1 950 966.12 1334.8 950 991.9 1336.9 950 1025.16 1542.5 1150 1086.35 1382 1150 1142.5 1447.2 1150 1203.15 1262.4 x is the x-axis and y is the y-axis. x-Water should be used to produce the horizontal error bars. How I can tell the program to do that. Thanks AA Ahmed M. Attia Research Assistant Dept. of SoilCrop Sciences Texas AM University ahmed.at...@ag.tamu.edu Cell phone: 001-979-248-5215 FAX: 001-308-455-4024 On Fri, Jul 18, 2014 at 3:30 PM, William Dunlap wdun...@tibco.com wrote: Is the original poster having trouble translating the synopsis at the top of the help file to actual code? He should look at the examples at the bottom of the help file, or better, run them with example(plotCI) and see if any of the plots looks close to what he wants. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jul 18, 2014 at 3:15 PM, Sarah Goslee sarah.gos...@gmail.com wrote: The example given in ?plotCI works just fine for me. You'll need to be more specific about what isn't working, and ideally provide some data with
Re: [R] Fwd: Plot the means with simultaneous horizontal and vertical error bars
In the package phenology (in CRAN), I add a function plot_errbar: plot_errbar(..., errbar.x = NULL, errbar.y = NULL, errbar.x.plus = NULL, errbar.x.minus = NULL, errbar.y.plus = NULL, errbar.y.minus = NULL, x.plus = NULL, x.minus = NULL, y.plus = NULL, y.minus = NULL, errbar.tick = 1/50, errbar.lwd = par(lwd), errbar.lty = par(lty), errbar.col = par(fg), errbar.y.polygon = FALSE, errbar.y.polygon.list = list(NULL), add = FALSE) It permits to plot errbar both on x and y. Sincerely, Marc Girondot Le 19/07/2014 02:27, Ahmed Attia a écrit : My problem is getting x and y into the PlotCI. I do not know how to use the dput(). But below is my data; x x-Water y 150 74.67 75 150 92.2 97 150 138.2 327.5 150 140.2 142.6 150 194.82 333.8 150 226.31 423 150 226.56 590.9 150 240.28 546.6 150 241.55 232.3 150 243.07 454.6 350 252.7 352.8 350 257.4 459.7 350 260.09 874.2 350 260.5 272.8 350 270.25 359.8 350 272.54 1008 350 286 638.9 350 288.3 791 350 288.54 736 350 291.34 816.3 350 297.0 465 350 303.8 234.3 350 306.58 601.9 350 310.38 942.9 350 311.3 334.4 350 317.75 522.1 350 330.45 563 350 333.78 717.4 350 339.59 851.5 350 341.37 642 350 342.7 490.5 350 344.2 487.7 350 344.42 1174 350 345.4 440.7 350 345.44 243 350 349.22 834.8 350 354.48 704.9 350 363.4 885 350 365.75 606.7 350 366.77 1036.9 350 370.08 898.8 350 371.09 640.9 350 372.69 768.1 350 374.24 574.4 350 375.15 200.9 350 375.3 1217 350 376.17 836.4 350 377.7 949.8 350 377.7 986.9 350 382.74 458.6 350 384 456.4 350 384.3 1189 350 385.9 978.2 350 388.44 379.7 350 391.66 865.7 350 392.44 1026.8 350 394.3 663.7 350 398.74 533.1 350 399.72 551.6 350 402.33 341.3 350 410.4 889 350 413 1530 350 419.35 1109.8 350 421.19 802.1 350 422.4 896.8 350 422.65 995.6 350 428.49 1337 350 433.72 1304.6 350 439.2 1190.4 350 439.42 914.3 350 440.43 1016.9 350 443 1266.1 350 446.4 659.3 350 448.05 369.3 550 455.34 1206.2 550 456.44 1139.9 550 458.45 1541.1 550 461.52 1048.4 550 461.77 486 550 462.45 910.6 550 467.49 1257 550 470.15 880.1 550 471.2 1155.7 550 471.32 1275 550 475.22 570.4 550 475.48 1226.6 550 481.58 1520 550 484.52 1549.6 550 488.29 1298 550 488.73 887.1 550 490.98 1261 550 491.08 1519.5 550 492.76 1082.6 550 499.38 1339.3 550 501.31 1121.3 550 503.42 1216.8 550 503.87 723.6 550 505.71 1488.6 550 506.74 1613.1 550 510.77 1460.9 550 514.09 1207.1 550 518.72 1167.771 550 519.93 1485.1 550 523.09 1025.8 550 526.79 986.5 550 530.34 874.5 550 532.89 1408.8 550 534.16 1197.7 550 538.1 1235.1 550 542.06 1219.7 550 545.34 1176.2 550 548.89 1366.4 550 550.668 1248 550 551.0 1434.4 550 551.84 1092.1 550 552.95 766.5 550 553.68 1465.7 550 556.76 1311.6 550 557.59 1247.3 550 558 1288.3 550 558.23 1115.257 550 567.66 1514.2 550 571.75 1249.9 550 571.82 1320 550 572.8 1397.2 550 577.89 1228 550 578 1580.1 550 578.5 1491.3 550 582.67 1304.3 550 587.75 1188.7 550 590.14 1476.8 550 592.07 1644.1 550 592.1 1334.4 550 596.9 1395.7 550 600.2 1468 550 602.76 978.3 550 604.01 1183.5 550 604.57 1051.49 550 608.98 1408.4 550 610.875 1189.9 550 616.45 1647.9 550 620.7 1193.3 550 623.58 1804 550 626.6 1575.8 550 629.16 1187.8 550 635.25 1468.2 550 638.34 1276 550 640.32 982.4 550 641 1241.3 550 647.5 1452.4 550 649.24 1826.5 750 653.56 1613.7 750 660.36 1731 750 665.22 1271.6 750 665.92 1172.369 750 669.03 1403.9 750 669.03 1261 750 669.94 1582.7 750 671.6 1296.4 750 673.35 1280.7 750 675.85 1306.8 750 678.43 1697.6 750 679.42 1435.1 750 679.48 1315.4 750 682.49 930.7 750 684.68 1612.1 750 685.29 1328.3 750 702.74 .3 750 704.58 980.6 750 712.97 1766.4 750 713.996 1163.7 750 714.4 1458 750 715.14 1238 750 717.14 1553.6 750 718.82 1653.9 750 720.55 1343.4 750 729.06 1053.063 750 730.754 1132 750 742.0 1293.2 750 755.87 1564.7 750 757.42 1211.7 750 764.03 1420.6 750 765.25 1449.4 750 766.08 1839 750 768.09 1579.1 750 769 1546.7 750 772.17 1779.6 750 772.41 1193.6 750 777.2 1880.7 750 783.62 1558.8 750 785.9 1259.4 750 788.64 1363.6 750 790.09 1398.4 750 793.22 1157.607 750 805.67 1135 750 808.99 1617.3 750 812.03 1246.4 750 820.672 1362 750 831.4 1586 750 842.51 1362.5 750 852.18 1597 950 852.18 1597 950 861.03 1554.4 950 865.26 1358.2 950 870.926 1713 950 872.74 1191.2 950 878.83 1544.1 950 895.62 1651.7 950 896.59 1233.2 950 901.22 1209.8 950 935.58 1278.7 950 944.11 1215.1 950 966.12 1334.8 950 991.9 1336.9 950 1025.16 1542.5 1150 1086.35 1382 1150 1142.5 1447.2 1150 1203.15 1262.4 x is the x-axis and y is the y-axis. x-Water should be used to produce the horizontal error bars. How I can tell the program to do that. Thanks AA Ahmed M. Attia Research Assistant Dept. of SoilCrop Sciences Texas AM University ahmed.at...@ag.tamu.edu Cell phone: 001-979-248-5215 FAX: 001-308-455-4024 On Fri, Jul 18, 2014 at 3:30 PM, William Dunlap wdun...@tibco.com wrote: Is
Re: [R-es] FW: Selección eficiente de individuos
Hola Carlos, ¿No es posible trabajar con el primer script y ejemplo que me enviaste? El motivo es que no acabo de entender el funcionamiento de este segundo script (he cambiado algún dato), pues creo que presenta 2 inconvenientes (por favor, corrígeme si me equivoco): datos - data.frame( id=1:3, entra=c('2001-01-01','2002-06-01','2003-01-01'), sale=c('2002-01-01','2002-12-31','2004-01-01')) # Entiendo que ref define los puntos que ha de cruzar el individuo:ref - new_interval(ymd('2001-12-31'), ymd('2003-12-31')) logical - mapply( function(x,y,z) {int_overlaps(new_interval(x,y),z)} ,datos$entra, datos$sale, ref) TRUE TRUE TRUE El primer y el tercer individuo cruzan respectivamente el 31 dic 2001 y el 31 dic 2003, correcto. Pero el segundo individuo NO llega a cruzar el 31 de diciembre de 2002 (pues sale justo en esa fecha), y en cambio el vector me devuelve ¿TRUE? [[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-es] [Grupo de Usuarios R Madrid]: Siguiente reunión el 1-julio... (Agenda disponible)...
Hola, No sé si os puede interesar el que para empezar y coger un poco más de masa crÃtica, el abrir un tanto más el alcance del grupo y unir fuerzas a otros colectivos que ya tengan presencia por allÃ: Periodistas de Datos, BigData, Analytics, etc. A través de Meetup podéis ver si existen ya otros grupos en marcha con estas inquietudes por vuestra zona. Seguramente los otros grupos también necesiten de aliados para igualmente conseguir esta masa crÃtica. Saludos, Carlos Ortega www.qualityexcellence.es El 17 de julio de 2014, 23:11, Jose Luis Cañadas Reche canadasre...@gmail.com escribió: Me pilla un poco lejos de dónde trabajo. ;) EstarÃa interesado en que fuera en Córdoba o Granada. Sé que en Granada hay unos cuantos eRReros entre la uni y alguna que otra empresa, y en Málaga también hay unos cuantos.. Saludos El 17/07/14 23:03, Rubén Gómez Antolà escribió: Hola: El 02/07/14 a las #4, Jose Luis Cañadas Reche escribió: [...] Ya de paso pregunto si alguien está interesado en hacer un GIL (Grupo de Interés Local) en AndalucÃa.. ¿En que zona tienes interés? En AlmerÃa no hay muchos eRReros pero alguno que otro estamos. Salud y Revolución. Lobo. ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es -- Saludos, Carlos Ortega www.qualityexcellence.es [[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-es] FW: Selección eficiente de individuos
Hola, No, fÃjate que en ref he puesto un intervalo mÃnimo de un dÃa: el fin de año del 2001 (2001-12-31) y el año nuevo del 2002 (2002-01-01). La idea de que este intervalo sea mÃnimo tiene justamente esta idea de confirmar si el empleado estuvo contratado tanto el 31 como el 1 del siguiente año. Si amplias mucho este intervalo como has hecho a dos años enteros (2002 y 2003) se produce el overlap. Saludos, Carlos Ortega www.qualityexcellence.es El 18 de julio de 2014, 10:17, Francisco Javier iterado...@hotmail.com escribió: Hola Carlos, ¿No es posible trabajar con el primer script y ejemplo que me enviaste? El motivo es que no acabo de entender el funcionamiento de este segundo script (he cambiado algún dato), pues creo que presenta 2 inconvenientes (por favor, corrÃgeme si me equivoco): datos - data.frame( id=1:3, entra=c('2001-01-01','2002-06-01','2003-01-01'), sale=c('2002-01-01','2002-12-31','2004-01-01')) # Entiendo que ref define los puntos que ha de cruzar el individuo: ref - new_interval(ymd('2001-12-31'), ymd('2003-12-31')) logical - mapply( function(x,y,z) {int_overlaps(new_interval(x,y),z)} ,datos$entra, datos$sale, ref) TRUE TRUE TRUE El primer y el tercer individuo cruzan respectivamente el 31 dic 2001 y el 31 dic 2003, correcto. Pero el segundo individuo NO llega a cruzar el 31 de diciembre de 2002 (pues sale justo en esa fecha), y en cambio el vector me devuelve ¿TRUE? -- Saludos, Carlos Ortega www.qualityexcellence.es [[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-es] [Grupo de Usuarios R Madrid]: Siguiente reunión el 1-julio... (Agenda disponible)...
Hola: El 18/07/14 a las #4, Carlos Ortega escribió: Hola, No sé si os puede interesar el que para empezar y coger un poco más de masa crítica, el abrir un tanto más el alcance del grupo y unir fuerzas a otros colectivos que ya tengan presencia por allí: Periodistas de Datos, BigData, Analytics, etc. Aquí en la zona ya lleva un tiempo andando el colectivo Hacklab Almería [0] con grupos de trabajo bastante heterogéneos: profesores, electrónicos, Androideros, programadores... y entre ellos un grupo de periodismo de datos. Este último se esta poniendo las pilas pero, aunque se les hizo una charla de iniciación/presentación de R, no se sienten demasiado atraídos, por el momento. A través de Meetup podéis ver si existen ya otros grupos en marcha con [...] Como digo, el Hacklab esta aglutinando a todos estos grupos más o menos dispersos, no obstante daremos un vistazo por ahí a ver si hay alguien. Gracias por la sugerencia. [...] El 17 de julio de 2014, 23:11, Jose Luis Cañadas Reche canadasre...@gmail.com escribió: Me pilla un poco lejos de dónde trabajo. ;) Estaría interesado en que fuera en Córdoba o Granada. Sé que en Granada hay unos cuantos eRReros entre la uni y alguna que otra empresa, y en Málaga también hay unos cuantos.. Con el actual estado de las comunicaciones con esas ciudades desde Almería, es un tanto inviable establecer un grupo estable de trabajo con vosotros. Quizás alguna colaboración puntual... En cualquier caso, bueno es saber que hay interés de montar algo en las zonas próximas. Saludos Salud y Revolución. Lobo. [0] http://www.hacklabalmeria.net/ -- Libertad es poder elegir en cualquier momento. Ahora yo elijo GNU/Linux, para no atar mis manos con las cadenas del soft propietario. Porque la libertad no es tu derecho, es tu responsabilidad. http://www.mucharuina.com - Desde El Ejido, en Almería, usuario registrado Linux #294013 http://www.counter.li.org ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R-es] FW: Selección eficiente de individuos
Muchas gracias Carlos y Olivier por vuestra paciencia y por vuestra ayuda. ¡Ahora ya sí que funciona! [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es