Re: [R] Putting colours in ggplot facets

2021-10-25 Thread phil
Thanks for the suggestions. As it happens, I just a moment ago found a solution. By adding the lines: ct$date <- 1 and ct$vari <- 1 everything works as I want it to. Philip On 2021-10-25 22:37, Ben Tupper wrote: Hi, I don't quite follow what you want to achieve - colored backgrounds for each

Re: [R] Putting colours in ggplot facets

2021-10-25 Thread Ben Tupper
Whoopsie. Misfired cut and paste - all 13 fingers are thumbs today. That second one should be... df <- dplyr::tibble(date,vari,geo,est) %>% dplyr::mutate(colr = paste(geo, est)) ggplot(df,aes(x=date,y=vari))+ geom_rect(aes(fill=colr), xmin=-Inf,xmax=Inf, ymin=-Inf,ym

Re: [R] Putting colours in ggplot facets

2021-10-25 Thread Ben Tupper
Hi, I don't quite follow what you want to achieve - colored backgrounds for each panel? You could RSeek.org for some ideas on how to fish the panels grobs out... https://rseek.org/?q=ggplot+facet+backgound+color https://rseek.org/?q=ggplot+facet+backgound+color I can get sort of close by skipp

[R] Putting colours in ggplot facets

2021-10-25 Thread phil
I am using ggplot2 and I want to use different colours for some facets. Here is a reprex: library(tidyverse) date <- as.numeric(c(2017,2017,2017,2017,2017,2017,2018,2018, 2018,2018,2018,2018,2019,2019,2019,2019,2019,2019)) vari <- as.numeric(c(4.8,3.3,4.2,5.2,4.8,5.7,5.4,3.1,5.7,4.1, 3.1,1.5

Re: [R] Dates as headers causing confusion but needed to convert to Julian days for ANOVA

2021-10-25 Thread Jeff Newmiller
I use check.names=FALSE more often than not, and I almost never end up changing them "anyway". Back-ticks as quotes are very effective at allowing unusual column names to be used in R code. (The only exception I have to this is when programatically building formulas the eval step gets quite conv

Re: [R] Dates as headers causing confusion but needed to convert to Julian days for ANOVA

2021-10-25 Thread Daniel Nordlund
On 10/25/2021 7:09 AM, Philip Monk wrote: Hello, First post - apologies if I get anything wrong - either in describing the question (I've only been using R for a week) or etiquette. I have CSV files of Land Surface Temperature (LST) data derived from Landsat 8 data and exported from Google Eart

Re: [R] Dates as headers causing confusion but needed to convert to Julian days for ANOVA

2021-10-25 Thread Jeff Newmiller
You did not say which function you used to import the csv file, but it looks like you probably used read.csv without setting the check.names argument to FALSE. Whether you change that out not, once you have reshaped the data, you can use a format specifier with as.Date to extract a date. (See ?

Re: [R] cleanup/replacing a value on condition of another value

2021-10-25 Thread Avi Gross via R-help
I wonder why it is not as simple as: Call mutate on the data and have a condition that looks like: data %>% mutate(cases = ifelse(multiple_cond, NA, cases) -> output -Original Message- From: R-help On Behalf Of Dr Eberhard W Lisse Sent: Monday, October 25, 2021 11:49 AM To: r-help@r-pro

Re: [R] Dates as headers causing confusion but needed to convert to Julian days for ANOVA

2021-10-25 Thread Bert Gunter
Well, both newbies and oldies need to read and follow the Help files carefully. In this case, note the "check.names" argument of ?read.csv. You need to set it to FALSE in your (omitted) read.csv call, because your strings are not syntactically valid names (follow the "make.names" link to learn wha

[R] Dates as headers causing confusion but needed to convert to Julian days for ANOVA

2021-10-25 Thread Philip Monk
Hello, First post - apologies if I get anything wrong - either in describing the question (I've only been using R for a week) or etiquette. I have CSV files of Land Surface Temperature (LST) data derived from Landsat 8 data and exported from Google Earth Engine. I am investigating whether the co

Re: [R] Error: the leading minor of order 6 is not positive definite

2021-10-25 Thread Sandhya Prakash
Hi I'm too running a canonical correlation code but I'm getting my error like this can you please help me Get Outlook for Android [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRI

Re: [R] cleanup/replacing a value on condition of another value

2021-10-25 Thread Dr Eberhard W Lisse
Thank you very much, 'which' does the trick :-)-O greetings, el On 2021-10-25 19:06 , Rui Barradas wrote: Hello, Here is a pipe to replace based on the composite condition. It uses ?base::replace with an integer index vector. [...] library(dplyr) data(coronavirus, package = "coronavirus

Re: [R] cleanup/replacing a value on condition of another value

2021-10-25 Thread Rui Barradas
Hello, Here is a pipe to replace based on the composite condition. It uses ?base::replace with an integer index vector. In the end, filter is meant to show the changed value in context, remove it and assign the data.frame or tibble back to the input to change the original. library(dplyr) d

Re: [R] cleanup/replacing a value on condition of another value

2021-10-25 Thread Dr Eberhard W Lisse
Rui, that works for me too, but is not what I need to do. I want to make the 'cases' value for this particular country AND this particular date AND this particular type AND this particular value (ie ALL conditions must be fulfilled) become NA so that the tibble would change from [...]

[R] KeyboardSimulator mouse.get_cursor() Not Working

2021-10-25 Thread Sparks, John
Hi, I tried using the mouse.get_cursor() function in the KeyboardSimulator library but it appears to no longer be working. When I first tried it I got an error message Error in get_cursor() : function 'Rcpp_precious_remove' not provided by package 'Rcpp'. I installed and loaded the Rcpp lib

Re: [R] cleanup/replacing a value on condition of another value

2021-10-25 Thread Rui Barradas
Hello, The following works with me. library(coronavirus) library(dplyr) data(coronavirus, package = "coronavirus") #update_dataset(silence = FALSE) coronavirus %>% select(country, date, type, cases) %>% filter( country == 'Namibia', date == '2021-10-23', cases == 357 ) Ca

Re: [R] cleanup/replacing a value on condition of another value

2021-10-25 Thread Eric Berger
The tibble shows the 'date' column as type date but you are comparing io a string. Perhaps replace that piece by date == as.Date("2021-10-23") Not tested. HTH, Eric On Mon, Oct 25, 2021 at 2:26 PM Dr Eberhard W Lisse wrote: > > Hi, > > I have data from JHU via the 'coronavirus' package which ha

[R] cleanup/replacing a value on condition of another value

2021-10-25 Thread Dr Eberhard W Lisse
Hi, I have data from JHU via the 'coronavirus' package which has a value for the confirmed cases for 2021-10-23 which differs drastically (357) from what is reported in country (23). # A tibble: 962 × 4 country date type cases 1 Namibi