[R] Problem with regression line

2018-04-18 Thread CHATTON Anne via R-help
Hello, I am trying to graph a regression line using the followings: Age <- c(39, 47, 45, 47, 65, 46, 67, 42, 67, 56, 64, 56, 59, 34, 42, 48, 45, 17, 20, 19, 36, 50, 39, 21, 44, 53, 63, 29, 25, 69) BloodPressure <- c(144, 220, 138, 145, 162, 142, 170, 124, 158, 154, 162, 150, 140, 110, 128, 130,

[R] Reasons to Use R in a Public Administrations and Ideas for a Short Training

2018-04-18 Thread Lorenzo Isella
Dear All, Ages ago I posted to this mailing list asking for advice about to evangelize the use of R in an international public administration where the fact that R is free is not a decisive factor (actually its being "freeware" may even be seen negatively). After a long time, I think it is

[R] mgcv::gamm error when combining random smooths and correlation/autoregressive term

2018-04-18 Thread Mathew Guilfoyle
I am having difficulty fitting a mgcv::gamm model that includes both a random smooth term (i.e. 'fs' smooth) and autoregressive errors. Standard smooth terms with a factor interaction using the 'by=' option work fine. Both on my actual data and a toy example (below) I am getting the same

Re: [R] Problem with regression line

2018-04-18 Thread Eik Vettorazzi
Hi Anne, I would suggest to change the linear model to lm(BloodPressure~Age), as this model makes more sense in biological means (you would assume that age influences pressure, not vice versa) and also obeys the statistical assumption of weak exogeneity, that age can be measured without error, at

Re: [R] Problem with regression line

2018-04-18 Thread Gerrit Eichner
Hi, Anne, assign Age and Bloodpressure in the correct order to the axes in your call to plot as in: plot(y = Age, x = BloodPressure) abline(SimpleLinearReg1) Hth -- Gerrit - Dr. Gerrit Eichner

Re: [R] Reasons to Use R in a Public Administrations and Ideas for a Short Training

2018-04-18 Thread David L Carlson
Courses are good for people who are motivated to learn. It sounds like you need to generate the motivation first. Why not develop 4 - 5 case study examples? Kinds of analyses currently performed on Excel that would be easier to replicate and repeat using simple R scripts so that you are showing

Re: [R] Problem with regression line

2018-04-18 Thread David L Carlson
To expand on Eik Vettorazzi's answer: Don't use html emails. When the mailing list converts it to plain text, it often re-wraps lines so that your code becomes jumbled. First, you did not define coeff. You need to add coeff <- coef(SimpleLinearReg1) Second, you should use the formula you used

Re: [R] Understanding which

2018-04-18 Thread Ashim Kapoor
Dear Jeff and Eric, Okay and many thanks. Best Regards, Ashim On Wed, Apr 18, 2018 at 4:56 PM, Jeff Newmiller wrote: > Look at > > which(x>100) > > This is a zero-length vector. The negative of nothing is nothing, not a > list of all possible index values. > > Do you

Re: [R] Understanding which

2018-04-18 Thread Jeff Newmiller
Look at which(x>100) This is a zero-length vector. The negative of nothing is nothing, not a list of all possible index values. Do you want x[ !( x > 100 ) ] ? On April 18, 2018 6:13:30 AM CDT, Ashim Kapoor wrote: >Dear All, > >Here is a reprex: > >> x<- 1:100 >>

Re: [R] nMDS with R: missing values

2018-04-18 Thread David L Carlson
I'm not sure how you are incorporating time period into your data structure. Typically we are looking at plots or assemblages as the rows and taxa as the columns. Time period adds a third dimension that could be added as blocks of rows. For example, depending on the resolution of your data, one

Re: [R] Hacked

2018-04-18 Thread Ted Harding
Not necessarily. The R-help archives are publicly accessible, with a "sort by date" option. So if someone sets up a web=page monitor which reports back when new messages appear there (at the bpottom end), then their email addresses are readily copied (subject to " at " --> "@". Once they have the

Re: [R] Understanding which

2018-04-18 Thread Eric Berger
Here's a hint: > y <- which(x>100) > identical(y,y) # TRUE > identical(y,-y) # TRUE The '-' is misleading - it is absorbed into the empty y, leaving the request x[y] to be x for an empty set of indices. HTH, Eric On Wed, Apr 18, 2018 at 2:13 PM, Ashim Kapoor wrote: >

Re: [R] Event-triggered change in value with a time-delay

2018-04-18 Thread David Winsemius
> On Apr 18, 2018, at 1:04 AM, Hannah Meredith wrote: > > Hello, > > I am solving a set of ODEs using deSolve and have run into a problem I > would appreciate some advice on. One of the parameters (m) in the ODEs > changes between two states when one of the variables

[R] merge two data frame based on equal and unequal comparisons

2018-04-18 Thread Ding, Yuan Chun
Dear R users, I need to merge two data frames based on both equal and unequal comparisons. The "sqldf" package used to work well , but today, I cannot resolve the following error by reinstallation of the sqldf package. Can anyone suggest a different way to perform this kind of merge

Re: [R] Problem with regression line

2018-04-18 Thread CHATTON Anne via R-help
Hi Gerrit! Thank you so much! I mistakenly reversed the order of the variables of the regression. Actually what I meant to write was: lm(BloodPressure ~ Age). Best, Anne -Message d'origine- De : Gerrit Eichner [mailto:gerrit.eich...@math.uni-giessen.de] Envoyé : mercredi 18 avril 2018

Re: [R] Hacked

2018-04-18 Thread Fowler, Mark
Seems it must be the R-list. A horde of ‘solicitation’ emails began arriving about 27 minutes after I posted about not seeing any! Had left work by that time, so did not encounter them until now. From: Mark Leeds [mailto:marklee...@gmail.com] Sent: April 18, 2018 12:33 AM To: Rui Barradas Cc:

[R] Understanding which

2018-04-18 Thread Ashim Kapoor
Dear All, Here is a reprex: > x<- 1:100 > x[-which(x>100)] integer(0) In words, I am finding out which indices correspond to values in x which are greater than 100 ( there are no such items ) . Then I remove those indices. I should get back the x that I started with since there are no items

Re: [R] merge two data frame based on equal and unequal comparisons

2018-04-18 Thread Ding, Yuan Chun
HI All, I found that other R users experienced the same problem when using sqldf package. An expert provided solution, adding "method="raw" at the end as below, one or more of the columns in my data.frame are of class "AsIs" ( I don't know what it is) . When sqldf retrieves the result from

[R] Identifying columns with specific character

2018-04-18 Thread Farnoosh Sheikhi via R-help
Hello, I have a data frame with 400 columns and wanted to filter character columns with "$" in it.For example: >  x <- c("$5", "$89", "$10", "$34")  >  y <- c(1:4)>  My.Data <- data.frame (x,y)> My.Data    x y1  $5 12 $89 23 $10 34 $34 4 I want to detect the columns with $ and remove the $ from

[R] How to replace numeric value in the column contains Text (Factor)?

2018-04-18 Thread Marna Wagley
Hi R user, Would you mind to help me on how I can change a value in a specific column and row in a big table? but the column of the table is a factor (not numeric). Here is an example. I want to change dat[4:5,3]<-"20" but it generated NA> do you have any suggestions for me?

Re: [R] How to replace numeric value in the column contains Text (Factor)?

2018-04-18 Thread David L Carlson
The simplest would be to convert precip to character and then back to a factor if you really want it to be a factor. This will also remove the levels that no longer exist. str(dat) # 'data.frame': 5 obs. of 3 variables: # $ Sites : Factor w/ 5 levels "Site1","Site2",..: 1 2 3 4 5 # $ temp

Re: [R] How to replace numeric value in the column contains Text (Factor)?

2018-04-18 Thread Marna Wagley
Hi David and Jeff, Both ways worked for my table. it helped me a lot (I was really struggling on it to change the values and thinking to do manually). You are great. Thank you On Wed, Apr 18, 2018 at 11:13 AM, David L Carlson wrote: > The simplest would be to convert precip

Re: [R] How to replace numeric value in the column contains Text (Factor)?

2018-04-18 Thread Jeff Newmiller
I would recommend that you avoid converting (or letting R convert for you) your textual data values into factors until you have finished doing this kind of modification. You can restore the column to character data type either re-reading it with the stringsAsFactors=FALSE option to

Re: [R] Hacked

2018-04-18 Thread Luis Puerto
I don’t think that it’s a just a gmail issue. If some of you aren’t receiving those emails is probably because they get caught in your organization spam filter and they don’t reach you. Every time I write to the list I receive those messages. > On 18 Apr 2018, at 08:12, K. Elo

[R] Event-triggered change in value with a time-delay

2018-04-18 Thread Hannah Meredith
Hello, I am solving a set of ODEs using deSolve and have run into a problem I would appreciate some advice on. One of the parameters (m) in the ODEs changes between two states when one of the variables (D) crosses a threshold (D_T) for the first time in either direction. Additionally, when the

Re: [R] Hacked

2018-04-18 Thread Martin Maechler
> Peter Langfelder > on Tue, 17 Apr 2018 11:50:19 -0700 writes: > I got some spam emails after my last post to the list, and the emails > did not seem to go through r-help. The spammers may be subscribed to > the r-help, or they get the poster

Re: [R] how to write a loop to repetitive jobs

2018-04-18 Thread jim holtman
Try this: result <- lapply(71:75, function(x){ # use 'paste0' to add the number to the file name input <- read.csv(paste0("C:/Awork/geneAssociation/removed8samples/neuhausen", x, "/seg.pr3.csv") , head=TRUE )

Re: [R] Identifying columns with specific character

2018-04-18 Thread Rui Barradas
Hello, To the OP: The dollar sign is a meta character, so it must be escaped, that is what was wrong with your code. The right regular expression would be grepl("\\$", x) When a regular expression doesn't work, try reading the help page ?regex. Another good source you can try is

Re: [R] Identifying columns with specific character

2018-04-18 Thread Jeff Newmiller
Your message came through all messed up because you did not tell your email program to use plain text format. This at best delays a responds and at worst prevents us from understanding your question as you intended. 1) The columns became factors when you created the data frame because you did

Re: [R] Identifying columns with specific character

2018-04-18 Thread Jim Lemon
Hi Farnoosh, Perhaps this will help: drop_dollar<-function(x) return(as.numeric(as.character(gsub("\\$","",x sapply(My.Data,drop_dollar) Jim On Thu, Apr 19, 2018 at 7:23 AM, Farnoosh Sheikhi via R-help wrote: > Hello, > I have a data frame with 400 columns and wanted

Re: [R-es] Pasar variables de data frame a una sola variable

2018-04-18 Thread Carlos Ortega
Hola, Mira la forma de hacerlo aquí: https://stackoverflow.com/questions/7398998/re-arrange-multiple-columns-in-a-data-set-into-one-column-using-r Saludos, Carlos Ortega www.qualityexcellence.es El 18 de abril de 2018, 15:34, Diego Iglesias escribió: > Hola erreros! >

[R-es] Pasar variables de data frame a una sola variable

2018-04-18 Thread Diego Iglesias
Hola erreros! Acudo de nuevo a ustedes porque ando enredado con algo que debe ser simple pero que no consigo. Lo que ando buscando hacer es pasar todas las variables de un dataframe a solo una variable (columna) con la info apilada. Lo que tengo es un dataframe así (con 200 variables y 30,000

Re: [R-es] Pasar variables de data frame a una sola variable

2018-04-18 Thread Diego Iglesias
Gracias Carlos y Javier, justo lo que estaba buscando es lo que generan las funciones stack y unstack Saludos, Diego iglesias El 18 de abril de 2018, 11:26, Javier Marcuzzi < javier.ruben.marcu...@gmail.com> escribió: > Estimado Diego Iglesias > > Lo que usted desea me genera dudas, por un lado

Re: [R-es] Pasar variables de data frame a una sola variable

2018-04-18 Thread Javier Marcuzzi
Estimado Diego Iglesias Lo que usted desea me genera dudas, por un lado cuándo yo reagrupo armo algo parecido a lo aportado por Carlos Ortega, pero dos columnas, la variable y su valor, pero si usted realmente desea una columna donde agrega todas, puede realizar un rbind, en otras palabras pega

[R-es] Interpretar intercepto de modelo ZINB

2018-04-18 Thread miriam . alzate
Buenas tardes, ¿Cómo interpretarías el intercepto que da R en un modelo de ceros inflados? Por un lado en la parte de conteo tengo un intercepto de -4.2 y en la parte de ceros de 102, ambos salen significativos (***). ¿Qué me dirían? Gracias ___