Re: [R] string concatenation

2020-11-04 Thread Jiefei Wang
Hi John, Try paste0(x,collapse = ", ") Best, Jiefei On Thu, Nov 5, 2020 at 1:16 PM John wrote: > Hi, > > I have a sequence of characters: > > x <- c("Alice", "Bob", "Charles") > > How can I produce the following results: > > "Alice, Bob, Charles" > > ? > > paste? merge? > > Thank you very

Re: [R] [EXT] string concatenation

2020-11-04 Thread Andrew Robinson
Try paste(x, collapse = ", ") Cheers, Andrew -- Andrew Robinson Director, CEBRA and Professor of Biosecurity, School/s of BioSciences and Mathematics & Statistics University of Melbourne, VIC 3010 Australia Tel: (+61) 0403 138 955 Email: a...@unimelb.edu.au Website:

[R] string concatenation

2020-11-04 Thread John
Hi, I have a sequence of characters: x <- c("Alice", "Bob", "Charles") How can I produce the following results: "Alice, Bob, Charles" ? paste? merge? Thank you very much! [[alternative HTML version deleted]] __ R-help@r-project.org

[R] Fwd: Error message when using "revtools" package

2020-11-04 Thread Bert Gunter
Neglected to cc the list! Bert -- Forwarded message - From: Bert Gunter Date: Wed, Nov 4, 2020 at 6:40 PM Subject: Re: [R] Error message when using "revtools" package To: John , R-help Perhaps better suggestion: r-sig-meta-analysis ? Bert Gunter "The trouble with having an

Re: [R] Error message when using "revtools" package

2020-11-04 Thread Bert Gunter
Perhaps better suggestion: r-sig-meta-analysis ? Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) [[alternative HTML version deleted]]

[R] Error message when using "revtools" package

2020-11-04 Thread John
Hi, I tried to read a bib file by "read_bibliography" function in "revtools" package, but I got an error message but don't know how to fix it. Anyone can help? Thank you so much!! ### library(revtools) data2 <- read_bibliography("mlf_ref201105_2.bib", return_df = FALSE) ### Error

Re: [R] Intended use-case for data.matrix

2020-11-04 Thread Duncan Murdoch
On 04/11/2020 4:43 p.m., Philip Charles wrote: Hi Duncan, Thanks; that's really useful info, and now that you point it out I completely agree that the frame arguments description does make my original use invalid - I will pay closer attention to such details in future.  Would you suggest

Re: [R] Intended use-case for data.matrix

2020-11-04 Thread Philip Charles
Hi Duncan, Thanks; that's really useful info, and now that you point it out I completely agree that the frame arguments description does make my original use invalid - I will pay closer attention to such details in future. Would you suggest sapply(...,as.numeric) is the most 'R'-y way of

Re: [R] Intended use-case for data.matrix

2020-11-04 Thread Duncan Murdoch
You can see the change to the help page here: https://github.com/wch/r-source/commit/d1d3863d72613660727379dd5dffacad32ac9c35#diff-9143902e81e6ad39faace2d926725c4c72b078dd13fbb1223c4a35f833b58ee6 Before the change, it said the input should be a data frame whose components are logical vectors,

Re: [R-es] Concatenar secuencia hasta el final con ifelse

2020-11-04 Thread miriam . alzate
Perfecto! He ejecutado el código y funciona, sí es lo que necesitaba. Muchísimas gracias. Miriam El Mie, 4 de Noviembre de 2020, 20:27, Marcelino de la Cruz Rot escribió: > No sé si te he entendido pero con el código que te he mandado, todas las > observaciones que tengan 1, 2, 3, 4 o 5  en

[R] Intended use-case for data.matrix

2020-11-04 Thread Philip Charles
Hi R gurus, We do a lot of work with biological -omics datasets (genomics, proteomics etc). The text file inputs to R typically contain a mixture of (mostly) character data and numeric data. The number of columns (both character and numeric data) in the file vary with the number of samples

Re: [R] build a literature database

2020-11-04 Thread Rainer Krug via R-help
I agree with Duncan. I co-ordinated a large literature review with initially more than 5000 papers and about 30 reviewers, and all the bibliometrics information was in bibtex format, as it is easy to interchange between programs. Cheers, Rainer > On 4 Nov 2020, at 10:28, Duncan Murdoch

Re: [R-es] Concatenar secuencia hasta el final con ifelse

2020-11-04 Thread Marcelino de la Cruz Rot
No sé si te he entendido pero con el código que te he mandado, todas las observaciones que tengan 1, 2, 3, 4 o 5  en Data$Order.individual tendrán 1 en Data$Order.Page; todas las que tengan 6, 7, 8, 9, 0 10, tendrán 2 en Data$Order.Page, etc, aunque haya varias que tengan valor 1 en esa

Re: [R-es] Concatenar secuencia hasta el final con ifelse

2020-11-04 Thread miriam . alzate
Hola, muchas gracias por contestar, Creo que no es exactamente eso porque a veces la variable Data$Order.individual es común a varias observaciones de la base de datos, es decir, puede haber varias observaciones que tengan valor 1 en esa variable. Si lo hago de la forma que me dices, no se si está

Re: [R-es] Concatenar secuencia hasta el final con ifelse

2020-11-04 Thread Marcelino de la Cruz Rot
Hola: Si se tratase, como parece implícito, de que cada 5 unidades de Data$Order.individual equivale a 1 unidad de Data$Order.Page, y si el máximo valor es 16000, tendrías en total 16000/5 = 3200 valores posibles para Data$Order.Page. Por lo tanto, podrías hacer algo así: valores <-

Re: [R] colMeans function

2020-11-04 Thread Rui Barradas
Hello, No, flights[2] is *not* equal to flights$months. The former is a data.frame with only one column, therefore it has a dimension attribute. The latter is a column, a vector of the data.frame flights, it does not have the attribute dim set. The difference is very important, see what

[R-es] Concatenar secuencia hasta el final con ifelse

2020-11-04 Thread miriam . alzate
Hola, Necesito asignar a cada observación un orden según su posición en un listado, estoy aplicando el siguiente código, pero no se cómo extenderlo para que lo haga hasta el final de las observaciones sin hacerlo manualmente: Data$Order.Page <- ifelse(Data$Order.individual <=5, 1,

Re: [R] colMeans function

2020-11-04 Thread Marc Schwartz via R-help
Hi, You might want to become familiar with the ?str and ?dim functions, which can help you identify the structure of the objects that you are passing to colMeans(). In the first case, flights[2] is a data frame with a single column, so will have two dimensions with a row and column structure.

Re: [R] colMeans function

2020-11-04 Thread Duncan Murdoch
On 04/11/2020 8:26 a.m., Engin Yılmaz wrote: Dear I use *flights* database library(nycflights13) The following code is working as colMeans(flights[2]) * 6.54851* but other code is not working as colMeans(flights$month) *Error in colMeans(flights$month) : * * 'x' must be an array of at

[R] colMeans function

2020-11-04 Thread Engin Yılmaz
Dear I use *flights* database library(nycflights13) The following code is working as colMeans(flights[2]) * 6.54851* but other code is not working as colMeans(flights$month) *Error in colMeans(flights$month) : * * 'x' must be an array of at least two dimensions* *flights[2]* is equal to

Re: [R] build a literature database

2020-11-04 Thread Koenker, Roger W
You might also want to take a look at this survey: https://ropensci.org/technotes/2020/05/07/rmd-citations/ > On Nov 4, 2020, at 9:22 AM, John wrote: > > Hi, > > I 'd like to create a table for literature review. Is there any good > data structure (database) I may use? Now I just use a

Re: [R] build a literature database

2020-11-04 Thread Michael Dewey
Dear John If you are doing a systematic review have you thought of investigating some of the packages in the CRAN Task View on MetaAnalysis like metagear or revtools? I have not used any of them but they claim to support that part of the process. Michael On 04/11/2020 09:22, John wrote:

Re: [R] newdata for predict.lm() ??

2020-11-04 Thread Boris Steipe
Solved. Thanks Achim and Peter ... though following that approach we now are relying implicitly on column names. But at least I've got this silly example working now. Thanks for the explanation Achim. :-) > On 2020-11-04, at 20:05, Achim Zeileis wrote: > > EXTERNAL EMAIL: Treat content

Re: [R] newdata for predict.lm() ??

2020-11-04 Thread Achim Zeileis
On Wed, 4 Nov 2020, peter dalgaard wrote: Don't use $ notation in lm() formulas. Use lm(w ~ h, data=DAT). ...or in any other formula for that matter! Let me expand a bit on Peter's comment because this is really a pet peeve of mine: The idea is that the formula "w ~ h" described the

Re: [R] newdata for predict.lm() ??

2020-11-04 Thread peter dalgaard
Don't use $ notation in lm() formulas. Use lm(w ~ h, data=DAT). -pd > On 4 Nov 2020, at 10:50 , Boris Steipe wrote: > > Can't get data from a data frame into predict() without a detour that seems > quite unnecessary ... > > Reprex: > > # Data frame with simulated data in columns "h"

[R] newdata for predict.lm() ??

2020-11-04 Thread Boris Steipe
Can't get data from a data frame into predict() without a detour that seems quite unnecessary ... Reprex: # Data frame with simulated data in columns "h" (independent) and "w" (dependent) DAT <- structure(list(h = c(2.174, 2.092, 2.059, 1.952, 2.216, 2.118, 1.755,

Re: [R] build a literature database

2020-11-04 Thread Duncan Murdoch
On 04/11/2020 4:22 a.m., John wrote: Hi, I 'd like to create a table for literature review. Is there any good data structure (database) I may use? Now I just use a simple dataframe as follows, but in the second item I swap the order of year and author, and it records 2013 as author and "XH"

[R] build a literature database

2020-11-04 Thread John
Hi, I 'd like to create a table for literature review. Is there any good data structure (database) I may use? Now I just use a simple dataframe as follows, but in the second item I swap the order of year and author, and it records 2013 as author and "XH" as year. Is there any better structure