[R] coef does not work for my ASReml model

2018-05-22 Thread Mehrshad Barary
Hi Everyone, I am using ASReml to fit a spatial model. I do not have all the components of ASReml when I call; names(summary()) e.g. names(summary(fcov.asr2)) [1] "call""loglik" "nedf""sigma" "varcomp" I am trying to get the coefs but I get "NULL". Does anybody know the reason? Any

Re: [R] find the permutation function of a sorting

2018-05-22 Thread David Winsemius
> On May 22, 2018, at 11:37 PM, John wrote: > > > > sort(c("bc","ac","dd"), index.return=TRUE) > $x > [1] "ac" "bc" "dd" > > $ix > [1] 2 1 3 > > > We have the permutation, namely 1-->2, 2-->1, 3-->3. > How can I apply the permutation function to a new set > c("D","E",

Re: [R] find the permutation function of a sorting

2018-05-22 Thread Jeff Newmiller
Perhaps the question was "what is indexing"? On May 23, 2018 5:06:39 AM GMT+02:00, David Winsemius wrote: > > >> On May 22, 2018, at 10:57 PM, John wrote: >> >> Thanks, David. >> I got the answer from the web. >> Is there any easy way to permute a

Re: [R] [FORGED] Re: drc, ggplot2, and gridExtra

2018-05-22 Thread Paul Murrell
Hi You need to be careful - you are grid.echo()ing (and then grid.grab()ing) on full-size pages and then redrawing in half-height pages, which is why you lose the x-axis labels in the result from grid.arrange(). This gives a better result (grid.echo() directly in the half-height viewports)

Re: [R] find the permutation function of a sorting

2018-05-22 Thread John
> sort(c("bc","ac","dd"), index.return=TRUE) $x [1] "ac" "bc" "dd" $ix [1] 2 1 3 We have the permutation, namely 1-->2, 2-->1, 3-->3. How can I apply the permutation function to a new set c("D","E", "F")? so that the result is c("E","D", "F"). 2018-05-23 11:06 GMT+08:00 David Winsemius

Re: [R] find the permutation function of a sorting

2018-05-22 Thread David Winsemius
> On May 22, 2018, at 10:57 PM, John wrote: > > Thanks, David. > I got the answer from the web. > Is there any easy way to permute a set (e.g., a set of characters) by the > permutation it returns? Thanks, > > > > x <- c(10,7,4,3,8,2) > > sort(x, index.return=TRUE) > $x

Re: [R] find the permutation function of a sorting

2018-05-22 Thread John
Thanks, David. I got the answer from the web. Is there any easy way to permute a set (e.g., a set of characters) by the permutation it returns? Thanks, > x <- c(10,7,4,3,8,2) > sort(x, index.return=TRUE) $x [1] 2 3 4 7 8 10 $ix [1] 6 4 3 2 5 1 2018-05-23 10:49 GMT+08:00 David Winsemius

Re: [R] find the permutation function of a sorting

2018-05-22 Thread David Winsemius
> On May 22, 2018, at 10:06 PM, John wrote: > > Hi, > > Is there any way to find the permutation function of the sorting and to > apply the function (or its inverse) elsewhere? > > For example, the following permutation function from the sorting in the > matrix form is

Re: [R] Plot qualitative y axis

2018-05-22 Thread Pedro páramo
Many thanks, My goal is to make a plott like attached but the Y axis starts in XIV and end at top in I. Generally for instance in excel X axis is categories but Y axis is numbers I want the contrary plotted in lines, your last help is near what I look but barplot is not needed. Hope you can

[R] find the permutation function of a sorting

2018-05-22 Thread John
Hi, Is there any way to find the permutation function of the sorting and to apply the function (or its inverse) elsewhere? For example, the following permutation function from the sorting in the matrix form is c(1,2,3), c(2,1,3) > sort(c("bc","ac","dd")) [1] "ac" "bc" "dd" I try to

Re: [R] legend order in ggplot2

2018-05-22 Thread John
Hi, I ran your code, but the results were not as expected. After I ran the code by "source", it return No id variables; using all as measure variables > p2 and no line or legend is on the graph (as attached) Am I doing anything wrong? John library(ggplot2) library(reshape2)

Re: [R-es] Pasar palabras de una lista a una variable del dataframe

2018-05-22 Thread miriam . alzate
Muchas gracias Carlos, Me da error al hacerlo. Mi variable donde quiero que localice las palabras de la lista tiene más de una palabra, no se si puede ser por eso. Gracias El Mar, 22 de Mayo de 2018, 20:15, Carlos Ortega escribió: > Hola, > > Aquí tienes un ejemplo (reproducible)... > >

[R] system() or pipe(..., open = "r") without child process?

2018-05-22 Thread Benjamin Tyner
Greetings On linux, is it possible to invoke an OS command from within R without spawning a child process? If not, is it possible to avoid copying the "parts of the caller's context" that are mentioned on the clone manpage?  ENOMEM Cannot  allocate  sufficient memory to allocate a task

Re: [R] Trouble building R 3.5.0 under Ubuntu 18.04

2018-05-22 Thread Bert Gunter
Seems O/T for this list, which is about R programming. Have you tried an internet search on "Install R on ubuntu" or similar. I found this: https://www.linode.com/docs/development/r/how-to-install-r-on-ubuntu-and-debian/ There are also r-sig-debian and r-sig-fedora mailing lists, in case that

[R] Trouble building R 3.5.0 under Ubuntu 18.04

2018-05-22 Thread Steve Gutreuter
I would love to hear from anyone who has successfully built 3.5.0 under Ubuntu 18.04 (Bionic Beaver). My attempts have failed, including: export LDFLAGS="$LDFLAGS -fPIC" export CXXFLAGS="$CXXFLAGS -fPIC" export CFLAGS="$CFLAGS -fPIC" ./configure --enable-R-shlib --prefix=/usr/lib/R/3.5.0

Re: [R] drc, ggplot2, and gridExtra

2018-05-22 Thread William Michels via R-help
Hi, I was able to get Eivind's code to work by slight modification of the "grab" function: grab <- function() { grid.echo() grid.grab() } Best Regards, W. Michels, Ph.D. On Fri, May 18, 2018 at 9:56 AM, Eivind K. Dovik wrote: > On Fri, 18 May 2018, Ed Siefker

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Bailey Hewitt
Ah ok this solves it for me, thank you!  Bailey From: Bert Gunter Sent: May 22, 2018 4:42 PM To: Bailey Hewitt Cc: Daniel Nordlund; r-help@R-project.org Subject: Re: [R] Using tryCatch in a for loop   No. If your ouput is a numeric "matrix", it cannot

Re: [R] [FORGED] Re: draw borders of bars inside of the rectangles in a barplot

2018-05-22 Thread Paul Murrell
Hi In addition to Richard's suggestion to add borders to the "only filled" bars, you could add "mitred" corners, like this ... par(ljoin="mitre") barplot(x, beside=T, border=rep(c('black', 'black'),5), space=c(0.08,1), col=rep(c('black', 'white'),5)) It may be overkill, but if the

[R] Poisson regression with GEE using stepwise selection of independent variables.

2018-05-22 Thread Sorkin, John
Is there any way to perform stepwise Poisson regression with GEE in R? (I know, and agree that stepwise procedures are not best statistical practice. I have developed a model with 10 independent variables, my client want me to include 50 other independent variables. I, of course, don't what to

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Bert Gunter
No. If your ouput is a numeric "matrix", it cannot include alpha. Columns in a data frame can be of different classes, but each column must be single class. and finally, of course, see ?cat -- I think you are misusing it. If you simply want to return "somestuff", your function should be:

Re: [R-es] Pasar palabras de una lista a una variable del dataframe

2018-05-22 Thread Javier Marcuzzi
Estimados Estoy de acuerdo con lo que ustedes dicen, en mi caso estoy utilizando c# por comodidad porque tengo fuentes de datos con más de un millón de palabras, lógicamente hay repetidas, pero lo que habría que tener en cuenta y sucede en mi caso particular, lo que no quiere decir que a Mirian

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Daniel Nordlund
On 5/22/2018 11:32 AM, Bailey Hewitt wrote: Hi Bert, Thank you for the quick response! In its current state the code prints three lines that say "warning". What I was expecting is that I would get a matrix with 4 columns, 1. column names (from the original data, ex. Lake1) 2. breakpoint year

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Bert Gunter
(practically) ALWAYS respond to the list. I have cc'ed them here. Others may (almost always do!) have greater insight/better answers than I. In this case, I have no clue, but presumably your call is wrong, but as I have no experience with the segmented.lm function, I don't care to track down how

Re: [R-es] Pasar palabras de una lista a una variable del dataframe

2018-05-22 Thread Jorge I Velez
Una forma es con %in%. —JIV El El mar, 22 de may. de 2018 a las 11:46 a. m., Miriam Alzate < miriam.alz...@unavarra.es> escribió: > Buenas tardes, > > Tengo una lista de 600 palabras. Quiero saber cuántas de esas palabras > aparecen en cada observación de mi variable "texto". La variable

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Bailey Hewitt
Hi Bert, Thank you for the quick response!  In its current state the code prints three lines that say "warning". What I was expecting is that I would get a matrix with 4 columns, 1. column names (from the original data, ex. Lake1) 2. breakpoint year 3. slope 4. slope difference from the first

Re: [R-es] Pasar palabras de una lista a una variable del dataframe

2018-05-22 Thread Carlos Ortega
Hola, Aquí tienes un ejemplo (reproducible)... #--- > # Generar nombres de mujer > library(randNames) > val_tmp <- rand_names(1000, nationality = 'ES', gender = 'female') > head(val_tmp) # A tibble: 6 x 25 gender email dob registered phone cell nat name.title

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Bert Gunter
Others may have greater insight, but my response is: Exactly what did or didn't happen that makes you say the code didn't work? That is, what did or didn't you get when you ran it compared to your expectations? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep

[R-es] Pasar palabras de una lista a una variable del dataframe

2018-05-22 Thread Miriam Alzate
Buenas tardes, Tengo una lista de 600 palabras. Quiero saber cuántas de esas palabras aparecen en cada observación de mi variable "texto". La variable "texto" es de tipo caracter. ¿Cómo lo haríais? Muchas gracias. ___ R-help-es mailing list

Re: [R] remove rows of a matrix by part of its row name

2018-05-22 Thread William Dunlap via R-help
I think it is simpler to use !grepl() instead of -grep() here, since subscripting with logicals works properly when there are no matches. Also, since mat is a matrix, add the argument drop=FALSE so the result is a matrix when all but one rows are omitted. E.g., > mat <- matrix(1:6, nrow=3,

Re: [R] Nelson-Aalen Estimator in R: Error Message

2018-05-22 Thread A.C. van der Burgh
Thank you for your reply. It is about the MICE package indeed. I have tried your 'solution', but I do not see anything unusual going on. My variable Time is a numerical variable, ranging from 0 to 1200. My variable Falls is coded as zero one, where one is having the event. Maybe this

Re: [R] Nelson-Aalen Estimator in R: Error Message

2018-05-22 Thread peter dalgaard
Hard to tell from the info you are giving us. I assume this regards the "mice" package? One way to proceed is to set options(error=recover) which will dump you into the browser() environment when the error occurs and you can oka around and see what the value of variables was at the point of

[R] Nelson-Aalen Estimator in R: Error Message

2018-05-22 Thread A.C. van der Burgh
Dear all, Currently, I am doing a research project about serum sodium levels and falling. I am doing my analysis in R. I am performing the multiple imputation right now. I want to perform a survival analysis later, but therefore I need to specify the Nelson-Aalen estimator. My dataset is

Re: [R] remove rows of a matrix by part of its row name

2018-05-22 Thread Ahmed Serag
Thanks a lot. The code works great. Regards Ahmed ** Ahmed Serag Analytical Chemistry Department Faculty of Pharmacy Al-Azhar University Cairo Egypt From: Rui Barradas Sent: Tuesday, May 22, 2018 2:16 PM To:

Re: [R] remove rows of a matrix by part of its row name

2018-05-22 Thread Rui Barradas
Hello, Please always cc the list. As for the question, yes, it does. If you want to remove just the ones with exactly 73.1 use the pattern grep("^73\\.1$", etc) Explanation: Beginning of string: ^ End of string: $ Escape special characters: \\ (needed because the period is a special

Re: [R] remove rows of a matrix by part of its row name

2018-05-22 Thread Rui Barradas
Hello, Use grep to get the row indices and then subset with a *negative* index to remove those rows. rn <- scan(what = character(), text = " 70/556 71.1/280 72.1/556 72.1/343 73.1/390 73.1/556 ") mat <- matrix(rnorm(6*6), nrow = 6) row.names(mat) <- rn inx <- grep("73\\.", row.names(mat))

[R] remove rows of a matrix by part of its row name

2018-05-22 Thread Ahmed Serag
Dear R-experts, How can I remove a certain feature or observation by a part of its name. To be clear, I have a matrix with 766 observations as a rows. The row names are like this 70/556 71.1/280 72.1/556 72.1/343 73.1/390 73.1/556 Now I would like to remove all the rows that contain the text

[R] DCC model simulation in R

2018-05-22 Thread Sultan Islam
Hi, I have used R rmgarch package to implement EGARCH ADCC model from which I can extract conditional covariance matrix. Now I would like to introduce positive and/or negative shocks to see the asymmetric response of covariance. I have come to know that impulse response function (IRF) or

Re: [R] Bootstrap and average median squared error

2018-05-22 Thread Rui Barradas
Hello, Right! I copied from the OP's question without thinking about it. Corrected would be bootMedianSE <- function(data, indices){ d <- data[indices, ] fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d) ypred <- predict(fit) y <- d$crp median((y - ypred)^2) } Sorry,

Re: [R] Bootstrap and average median squared error

2018-05-22 Thread Daniel Nordlund
On 5/22/2018 2:32 AM, Rui Barradas wrote: bootMedianSE <- function(data, indices){ d <- data[indices, ] fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d) ypred <- predict(fit) y <- d$crp median(y - ypred)^2 } since the OP is looking for the "median squared

Re: [R] Bootstrap and average median squared error

2018-05-22 Thread Rui Barradas
I forgot, you should also set.seed() before calling boot() to make the results reproducible. Rui Barradas On 5/22/2018 10:00 AM, Rui Barradas wrote: Hello, If you want to bootstrap a statistic, I suggest you use base package boot. You would need the data in a data.frame, see how you could do

Re: [R] Bootstrap and average median squared error

2018-05-22 Thread Rui Barradas
Hello, If you want to bootstrap a statistic, I suggest you use base package boot. You would need the data in a data.frame, see how you could do it. library(boot) bootMedianSE <- function(data, indices){ d <- data[indices, ] fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d) ypred

Re: [R] legend order in ggplot2

2018-05-22 Thread PIKAL Petr
Hi Your approach seems to me rather complicated. I would reshape data before plotting and maybe also change order of levels in resulting variable factor library(reshape2) dfm<-melt(df) dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)]) p2<-ggplot(dfm, aes(x=rep(1:2,4),