Re: [R] Substituting elements in vector

2015-02-17 Thread David Winsemius
On Feb 17, 2015, at 3:58 AM, Knut Hansen wrote: Dear list, I have a vector: my.vector - c(A, B, C, D, E, F, G) and two other: vec1 - c(p, q, r, s, t) vec2 - c(x, y, z) I want to substitute elements b and e in my.vector with vectors vec1 and vec2 respectively so that the result

Re: [R] Substituting elements in vector

2015-02-17 Thread JS Huang
Hi, Here is an implementation. my.vector [1] A B C D E F G vec1 [1] p q r s t vec2 [1] x y z final - as.character(unlist(sapply(my.vector,function(x) if(x==B){vec1}else{if(x==E){vec2}else{x}}))) final [1] A p q r s t C D x y z F G -- View this message in context:

Re: [R] Error when I attempt to create a list or a data frame

2015-02-17 Thread JS Huang
Hi, It appears that you used left double quotation marks and right double quotation marks in your vector for characters. The first lst assignment is copied from your post and indicates issues. I retyped with doulbe quotation mark and went through fine with the second lst assignment. Unicode

Re: [R] Change error bar length in barplot2

2015-02-17 Thread Marc Schwartz
On Feb 17, 2015, at 10:46 AM, Joule Madinga jmadi...@yahoo.fr wrote: Hi,I'm new to R.I would like to make a barplot of parasite infection prevalence (with 95% confidence interval) by age group.I have 4 parasite species and 5 age-groups and the example by Marc Schwartz (barplot2) fits very

Re: [R] multiple imputation of longitudinal, time-unstructured data

2015-02-17 Thread John Sorkin
Pam, Please let me know what you discover. I just started looking at a similar problem. I understand that a Kalman filter can sometimes be applied to this problem, but at this time I don't know how to accomplish this. John John David Sorkin M.D., Ph.D. Professor of Medicine Chief,

[R] Bayesian Networks

2015-02-17 Thread Elias Carvalho
Has somebody implemented Bayesian Networks in R ? -- Best regards... 8^) “*A mente que se abre a novas ideias jamais voltará * *a seu tamanho original*” *Albert Einstein* _ Prof. Elias César Araújo de Carvalho CV:

Re: [R] %%

2015-02-17 Thread Hervé Pagès
On 02/17/2015 02:10 PM, Erich Neuwirth wrote: AFAIK dplyr imports magrtittr. So dplyr ses %% from migrittr, it does not have its own version. But it has its own man page so who knows? H. On Feb 17, 2015, at 22:19, Ben Bolker bbol...@gmail.com wrote: David Barron dnbarron at gmail.com

[R] Apply t-test on list in R

2015-02-17 Thread Zilefac Elvis via R-help
I have a list object in R with dataframe names as: pav_DJF_histo.csvpav_DJF_rcp26_2040s.csv pav_DJF_rcp26_2080s.csv pav_DJF_rcp45_2040s.csvpav_DJF_rcp45_2080s.csv pav_DJF_rcp85_2040s.csv pav_DJF_rcp85_2080s.csv pav_JJA_histo.csv pav_JJA_rcp26_2040s.csv pav_JJA_rcp26_2080s.csv

[R] multiple parameter optimization with optim()

2015-02-17 Thread Doran, Harold
I am trying to generalize a working piece of code for a single parameter to a multiple parameter problem. Reproducible code is below. The parameters to be estimated are a, b, and c. The estimation problem is such that there is one set of a, b, c parameters for each column of the data. Hence, in

Re: [R] %%

2015-02-17 Thread Hadley Wickham
On Tue, Feb 17, 2015 at 6:02 PM, Hervé Pagès hpa...@fredhutch.org wrote: On 02/17/2015 02:10 PM, Erich Neuwirth wrote: AFAIK dplyr imports magrtittr. So dplyr ses %% from migrittr, it does not have its own version. But it has its own man page so who knows? If you import and re-export a

Re: [R] Re categorizing components of varaibles

2015-02-17 Thread JS Huang
Hi, Here I use the data.frame b as an example to show how it can be accomplished. The sixth column of b has values 6 through 996 by an increment of 10. The statement sapply(b[,6],function(x)if(x==6){0}else{if(x==996){2}else{1}}) assigns 0 to 6, 2 to 996 and 1 to the rest in column 6. In your

[R] Numerical stability of eigenvalue and hessian matrix in R

2015-02-17 Thread C W
Hi list, I am running the following R code, the answer should be zero. But R gives a very small negative number, what should I do? ##R code library(numDeriv) h_x - function(x){ a = x[1] b = x[2] c = x[3] d = x[4] (a^2 + c^2 + d^2) * (b^2 + c^2 + d^2) } x1 = 10 x2 = 1 x3 = 0 x4

Re: [R] Bayesian Networks

2015-02-17 Thread Peter Alspach
Tena koe Elias Googling 'Bayesian Networks in R' brings up several packages, so the answer appears to be 'Yes'. Whether any of them are relevant to you is another question. HTH Peter Alspach -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of

Re: [R] sd, mean with a frequency distribution matrix

2015-02-17 Thread JS Huang
Hi, Just learned another way to calculate sd for a frequency distribution matrix: p - matrix(c(10,3,20,4,30,5),ncol=2,byrow=TRUE) p [,1] [,2] [1,] 103 [2,] 204 [3,] 305 rep(p[,1],p[,2]) [1] 10 10 10 20 20 20 20 30 30 30 30 30 sd(rep(p[,1],p[,2])) [1] 8.348471 --

Re: [R] faisalconjoint

2015-02-17 Thread Berend Hasselman
On 18-02-2015, at 05:02, BRC brc@gmail.com wrote: I am developing a r package faisalconjoint, when i run R CMD check --as-cran faisalconjoint, got the following notes. * using log directory 'D:/r-test-packages/faisalconjoint/faisalconjoint.Rcheck' * using R version 3.1.2

Re: [R] %%

2015-02-17 Thread Hervé Pagès
On 02/17/2015 08:03 PM, Hadley Wickham wrote: On Tue, Feb 17, 2015 at 6:02 PM, Hervé Pagès hpa...@fredhutch.org wrote: On 02/17/2015 02:10 PM, Erich Neuwirth wrote: AFAIK dplyr imports magrtittr. So dplyr ses %% from migrittr, it does not have its own version. But it has its own man page so

[R] faisalconjoint

2015-02-17 Thread BRC
I am developing a r package faisalconjoint, when i run R CMD check --as-cran faisalconjoint, got the following notes. * using log directory 'D:/r-test-packages/faisalconjoint/faisalconjoint.Rcheck' * using R version 3.1.2 (2014-10-31) * using platform: i386-w64-mingw32 (32-bit) * using session

Re: [R] ggplot2 shifting bars to only overlap in groups

2015-02-17 Thread John Kane
I had never thought of violins.  It might be interesting. However , I still think there maybe some use out of the 4-panel approach.  What does your vioilin code look like? Using Denis' code gg- ggplot(dat1, aes(x = condition, y = t, color = gender, linetype = direction)) +  

[R] Coding style question

2015-02-17 Thread John Posner
In the course of slicing-and-dicing some data, I had occasion to create a list like this: list( subset(my_dataframe, GR1==XX1), subset(my_dataframe, GR1==XX2), subset(my_dataframe, GR1==YY), subset(my_dataframe, GR1 %in% c(XX1, XX2)), subset(my_dataframe, GR2==Remission),

Re: [R] subsamples and regressions for 100 times

2015-02-17 Thread Michael Dewey
Comment inline On 17/02/2015 12:40, Angela Smith wrote: Hi R user, I'm new to R so my problem is probably pretty simple but I'm stuck: my data is consist of 2 variables: co2, temp and one treatment (l_group). The sample size is different among the treatments. so that, I wanted to make

[R] Substituting elements in vector

2015-02-17 Thread Knut Hansen
Dear list, I have a vector: my.vector - c(A, B, C, D, E, F, G) and two other: vec1 - c(p, q, r, s, t) vec2 - c(x, y, z) I want to substitute elements b and e in my.vector with vectors vec1 and vec2 respectively so that the result becomes the vector: c(A, p, q, r , s , t, C , D, x, y, z, F, G)

[R] subsamples and regressions for 100 times

2015-02-17 Thread Angela Smith
Hi R user, I'm new to R so my problem is probably pretty simple but I'm stuck: my data is consist of 2 variables: co2, temp and one treatment (l_group). The sample size is different among the treatments. so that, I wanted to make equal sample size among three groups (A,B and C) of the

[R] Image processing using R

2015-02-17 Thread Javier Rodriguez Zaurin
Hi all, I am starting an image processing project. Through the project, I am going to be needing tools/techniques such as SIFT, HOG, bag-of-visual-words/features etc... It seems than OpenCv has most of these features. I have found r-opencv here https://www.openhub.net/p/r-opencv , but from this

Re: [R] Loop over regression results

2015-02-17 Thread Ronald Kölpin
Thank you David and Thierry, your answers helped a lot! Kind regards, RK. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Autoregressive covariance structure for lme object and R/SAS differences in model output

2015-02-17 Thread anord
Thanks for your comments. I hard disk meltdown has slowed me down somewhat, but I am now back online. I have reposted to the ME-list, and requested SAS output from my colleagues. I will update the thread again as soon I know more. Thanks, Andreas -- View this message in context:

Re: [R] plm function plm r.squared error

2015-02-17 Thread Nina Schönfelder
Dear Constanze, the error message gives you a hint, where the problem might be. The first error massage says that you have NAs in your index variables Unit and Week. You can check that with the is.na() function. The second error message (r.squared) tells you to specify the model, that is on

Re: [R] compute values by condition in DF by rownames

2015-02-17 Thread JS Huang
Hi, I like the aggregate version. Here is an implementation with sapply and apply: data X2 gbm_tcga lusc_tcga ucec_tcga_pub 1 gbm_tcga 1.0 0.14053719 -0.102847164 2 gbm_tcga 1.0 0.04413434 0.013568055 3 gbm_tcga 1.0

Re: [R] split dataframe to several dataframes in R

2015-02-17 Thread Bert Gunter
Inline. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. Clifford Stoll On Tue, Feb 17, 2015 at 1:33 AM, Chris Campbell ccampb...@mango-solutions.com wrote: # Assuming you

[R] Help with looping

2015-02-17 Thread Alexandra Catena
Hi, I need help with a for loop and printing data. I want to loop through a few years and print the data from each year stacked on top of each other. For example, for (i in 2000:2003){ #script for downloading each year Data = readLines(sprintf('file/%4i,i)) } It only prints out the data from

[R] %%

2015-02-17 Thread André de Boer
Hello, Where can I find info about the operator %%? Never used it but when I search for it I gives no result. Thanks, André __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] Discrete variables with logistf

2015-02-17 Thread smb123
I am relatively new to R and I would appreciate some advice on how to include both discrete and continuous predictor variables in a stepwise backward log likelihood ration logistic regression. I have a model that includes 3 continuous predictor variables (soilmois, grasscov, and ranvar) and one

Re: [R] Image processing using R

2015-02-17 Thread David Winsemius
On Feb 17, 2015, at 6:51 AM, Javier Rodriguez Zaurin wrote: Hi all, I am starting an image processing project. Through the project, I am going to be needing tools/techniques such as SIFT, HOG, bag-of-visual-words/features etc... It seems than OpenCv has most of these features. I have

Re: [R] %%

2015-02-17 Thread Duncan Murdoch
On 17/02/2015 2:41 PM, André de Boer wrote: Hello, Where can I find info about the operator %%? Never used it but when I search for it I gives no result. That is a user-defined binary operator. You need to look in the sources that used it to find how it was defined. (See section 10.2 of

Re: [R] %%

2015-02-17 Thread David Barron
It's in the magrittr package. David On 17 February 2015 at 19:41, André de Boer rnie...@gmail.com wrote: Hello, Where can I find info about the operator %%? Never used it but when I search for it I gives no result. Thanks, André __

Re: [R] subsamples and regressions for 100 times

2015-02-17 Thread Angela Smith
Dear David and Michael, Thank you so much for the code. It helped me to understand in making a loop and perform the analysis. I am really obliged with your help. cheers, AS = From: dcarl...@tamu.edu To: i...@aghmed.fsnet.co.uk; angela.smith2...@hotmail.com; r-help@r-project.org

Re: [R] paste (CTRL + v) not working rgui

2015-02-17 Thread small_Data88
Hello, I am sure you have solved this problem, but I just experienced this same problem. I was able to fix this by closing my current R session and then reopening a new one. So, close your current R session and then open a new one and then you should be able to cut,copy,paste, etc :) I am running

Re: [R] ggplot2 shifting bars to only overlap in groups

2015-02-17 Thread Hörmetjan Yiltiz
The code is the same as the last one I showed, except I used geom_violin() instead. pp - ggplot(dat1, aes(x = condition, y = t, color = gender, linetype = direction)) + geom_violin() + facet_wrap(~ location) + scale_color_manual(values = c(blue, darkorange))+ theme_bw()+

Re: [R] split dataframe to several dataframes in R

2015-02-17 Thread Zilefac Elvis via R-help
Great! Thanks, Aravind. On Monday, February 16, 2015 10:50 PM, Aravind Jayaraman aravindjayaramana...@gmail.com wrote: Hi, I think you need not split the data.frame to get the desired result. You can work with your list lst4 itself. #Convert the vectors in the list to data.frames.

Re: [R] Coding style question

2015-02-17 Thread Duncan Murdoch
On 17/02/2015 11:19 AM, John Posner wrote: In the course of slicing-and-dicing some data, I had occasion to create a list like this: list( subset(my_dataframe, GR1==XX1), subset(my_dataframe, GR1==XX2), subset(my_dataframe, GR1==YY), subset(my_dataframe, GR1 %in% c(XX1,

Re: [R] subsamples and regressions for 100 times

2015-02-17 Thread David L Carlson
Expanding a bit on Michael's answer, you don't need the sampling package for this, just the sample.int() function to draw a random set of integers that you will use to extract rows from each of your groups. The write a function that returns what you want, the regression slopes from each group

Re: [R] split dataframe to several dataframes in R

2015-02-17 Thread Zilefac Elvis via R-help
Great! many thanks, Chris and Bert. On Tuesday, February 17, 2015 8:29 AM, Bert Gunter gunter.ber...@gene.com wrote: Inline. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not

Re: [R] Substituting elements in vector

2015-02-17 Thread Berend Hasselman
On 17-02-2015, at 12:58, Knut Hansen knut.han...@uit.no wrote: Dear list, I have a vector: my.vector - c(A, B, C, D, E, F, G) and two other: vec1 - c(p, q, r, s, t) vec2 - c(x, y, z) I want to substitute elements b and e in my.vector with vectors vec1 and vec2 respectively so

Re: [R] view large tables

2015-02-17 Thread jim holtman
What is 'large'? have you tried 'View'? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Feb 17, 2015 at 4:52 AM, carol white via R-help r-help@r-project.org wrote: what is the best function to

[R] Circlize package: add text to chord in symmetric matrix

2015-02-17 Thread Karim Mezhoud
Dear All temp matrix describes correlated genes by disease. Can I include which genes are common between diseases in chord diagram? temp X1 X2Disease1Disease2Disease3 1 Gene1 Disease1 1. -0.31428571 0.25714286 2 Gene2 Disease1 1. 0.42857143

[R] Change error bar length in barplot2

2015-02-17 Thread Joule Madinga
Hi,I'm new to R.I would like to make a barplot of parasite infection prevalence (with 95% confidence interval) by age group.I have 4 parasite species and 5 age-groups and the example by Marc Schwartz (barplot2) fits very well to my data.However, I would like to plot my own 95%CI (as calculated

Re: [R] %%

2015-02-17 Thread Ben Bolker
David Barron dnbarron at gmail.com writes: It's in the magrittr package. David It also exists in dplyr. (I would guess that it's imported/exported from magrittr.) Although I think the documentation in magrittr is a little better. __

Re: [R] compute values by condition in DF by rownames

2015-02-17 Thread Karim Mezhoud
Thanks JS I think aggregate function is better. Karim Le 17 févr. 2015 08:33, JS Huang js.hu...@protective.com a écrit : Hi, I hope that someone can provide a better way to implement it. This is my implementation. data X2 gbm_tcga lusc_tcga ucec_tcga_pub 1

[R] [R-pkgs] Release of phia 0.2-0

2015-02-17 Thread Helios de Rosario
Dear R users, I want to announce an update of the package phia, version 0.2-0, now on CRAN: http://cran.r-project.org/web/packages/phia/ phia (Post-Hoc Interaction Analysis) is aimed at the analysis of the expected values and other terms of in linear, generalized, and mixed linear models, on the

Re: [R] %%

2015-02-17 Thread Erich Neuwirth
AFAIK dplyr imports magrtittr. So dplyr ses %% from migrittr, it does not have its own version. On Feb 17, 2015, at 22:19, Ben Bolker bbol...@gmail.com wrote: David Barron dnbarron at gmail.com writes: It's in the magrittr package. David It also exists in dplyr. (I would

[R] multiple imputation of longitudinal, time-unstructured data

2015-02-17 Thread Pam Dopart
Hello! I have a longitudinal dataset of radiation exposures of an occupational cohort. A percentage of the exposure values are missing and I would like to multiply impute the missing values (it is one option of several we are comparing). The data are recorded in long format (one row for each

Re: [R] Help with looping

2015-02-17 Thread Mark Sharp
Alexandra, According to the documentation (?readLines), readLines returns a character vector with one line from the file being read in each element of the vector. You can put the character vector from each file (as represented by a year designation in your example) in a separate list element.

Re: [R] Help with looping

2015-02-17 Thread Mark Sharp
Alexandra, According to the documentation (?readLines), readLines returns a character vector with one line from the file being read in each element of the vector. You can put the character vector from each file (as represented by a year designation in your example) in a separate list element.

Re: [R] Help with looping

2015-02-17 Thread Rui Barradas
Hello, Try the following. Data - lapply(sprintf('file/%4i', 2000:2003), readLines) This will give you a list with 4 elements, each of which is the contents of each file. Hope this helps, Rui Barradas Em 17-02-2015 18:15, Alexandra Catena escreveu: Hi, I need help with a for loop and

Re: [R] split dataframe to several dataframes in R

2015-02-17 Thread Chris Campbell
# Assuming you want to create many data frames, you can use # assign to create new objects. newDFNames - unique(means$source) newDFNames # [1] iris1.csv iris2.csv for (nm in newDFNames) { assign(x

[R] view large tables

2015-02-17 Thread carol white via R-help
what is the best function to view large tables or data frames, scrolling down-up, left-right? Thanks c. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

[R] Different serialization and digest hash value of functions

2015-02-17 Thread Holger Hoefling
Hi, I am using hash-values to cache certain results in R. This caching also depends on the hash-value of the function that is being cached (calculated using the digest package). I noticed that computations that should already be cached are recomputed when switching from an interactive session to