Re: [R] indices of mismatch element in two vector with missing values

2015-07-28 Thread Hervé Pagès
On 07/28/2015 09:58 PM, Peter Alspach wrote: One way seq(test1)[-which(test1==test2)] One question is whether 2 NAs should be considered to match or not. The OP doesn't tell but I guess he wants them to match: test1 <- c("1", "2", NA, "4", NA, "6") test2 <- c("1", "2", "3", NA, NA, "66

Re: [R] indices of mismatch element in two vector with missing values

2015-07-28 Thread Hervé Pagès
Hi, On 07/28/2015 01:25 PM, baccts wrote: How would you return the index where two vectors differs if they may contain missing (NA) values? For example: test1 <- c("1","2",NA); test2 <- c("1","2","3"); which(test1!=test2) does not return 3! which(test1 != test2 | is.na(test1) != is.na(test2))

Re: [R] Inquiry: R library for bioinformatics development process

2015-07-28 Thread Johannes Huesing
Faris Zaidi Bin Mohd Nor [Wed, Jul 29, 2015 at 05:38:59AM CEST]: Hi, I would like to know about the R library. Is there any library for bioinformatic development software purpose? Have you looked at the Bioconductor project? -- Johannes Hüsing There is something fascinating

Re: [R] indices of mismatch element in two vector with missing values

2015-07-28 Thread Peter Alspach
One way seq(test1)[-which(test1==test2)] but I imagine there are better ones . Peter Alspach -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of baccts Sent: Wednesday, 29 July 2015 8:26 a.m. To: r-help@r-project.org Subject: [R] indices of mismat

[R] npreg: average partial effects and customised partial regression plots

2015-07-28 Thread lisagrace7
Hi, I’ve created a simple fixed effects version of Li and Racine’s Kernel Regression with Mixed Data Types (npreg function from np package) by including an unordered firm id variable and ordered year variable as extra covariates. See below for the setup: ** bandwidth <- npregbw(formula = l

[R] Inquiry: R library for bioinformatics development process

2015-07-28 Thread Faris Zaidi Bin Mohd Nor
Hi, I would like to know about the R library. Is there any library for bioinformatic development software purpose? Sekian, terima kasih. "PEMIMPIN AGRO-TEKNOLOGI" "JIHAD MEMERANGI ORANG TENGAH" Saya yang menurut perintah, Faris Zaidi Bin Mohd Nor

[R] indices of mismatch element in two vector with missing values

2015-07-28 Thread baccts
How would you return the index where two vectors differs if they may contain missing (NA) values? For example: test1 <- c("1","2",NA); test2 <- c("1","2","3"); which(test1!=test2) does not return 3! Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/indices-of

Re: [R] vectorized sub, gsub, grep, etc.

2015-07-28 Thread John Thaden
Adam,    The method you propose gives a different result than the prior methods for these example vectors X <- c("ab", "cd", "ef") patt <- c("b", "cd", "a") repl <- c("B", "CD", "A") Old method 1 mapply(function(p, r, x) sub(p, r, x, fixed = TRUE), p=patt, r=repl, x=X) gives   b   cd    a "aB"

Re: [R] vectorized sub, gsub, grep, etc.

2015-07-28 Thread Adam Erickson
Hi John, The version I wrote performs vectorized full string matching and replacement with some error checking and flexible inputs. I think there are a lot of good reasons for using this method where possible (e.g., speed and reduced complexity). Duly noted that it is different from the original q

Re: [R] Opposite color in R

2015-07-28 Thread Duncan Mackay
Hi I plotted the 'spectrum' and it looked a little small - spectrum colours: red orange yellow green blue indigo violet. I suppose you could go to infinite lengths to split it up but is this an improvement? I have not gone into the "depths" of complimentary colours library(colorspace) ColorsR

Re: [R] Reading data with two rows of variable names using read.zoo

2015-07-28 Thread Nordlund, Dan (DSHS/RDA)
Not a guru, but this isn't that hard. The following works with your sample data. It shouldn't be too difficult to modify for your full file. library(zoo) df <- read.table('path_to_your_data', sep=';', skip=2, as.is=TRUE) str(df) substr(df$V1,5,5) <- '-' df$V1 <- as.yearqtr(substr(df$V1,1,6)) df

[R] Reading data with two rows of variable names using read.zoo

2015-07-28 Thread 김상환
Dear R gurus. I have a data file which has two rows of variable names. And the time index has a little unusual format. I have no idea how to handle two names and awkward indexing for the quarters. Lines <- " Index; UK; UK; JP; JP Index; a1; a2; a1; a2 2009 2/4;2;4;3;2 2009 3/4;5;2;1;4 2009 4/4;7;

Re: [R] Varying name of output tables from looped process of list of spdf objects

2015-07-28 Thread SisoL
Hi, Thank you for the replies. I tried Peter's suggestions and this worked: ###Read forest shape files setwd("/Users/sisolarrosa/Documents/PhD/R_work/AF/IIC/split_bf_fnp/") shps<- dir(getwd(), "*.shp") shps <- gsub('.{4}$', '', shps) for (shp in shps) assign(shp, readOGR(".",layer=shp)) ###Creat

[R] ggplot ternary plot: two quirks

2015-07-28 Thread Szumiloski, John
Dear useRs, I am using the ggtern package to generate ternary plots in ggplot2. I am making a diagram demonstrating how to interpret a ternary plot and am using ggtern::ggtern.multi to generate it. I intend to have three panels, one for the scale and grid for each component. However, is not

Re: [R] help_ReverseGeocoding

2015-07-28 Thread boB Rudis
You should use ggmap::revgeocode (it calls google's api) and google will rate-limit you. There are also packages to use HERE maps geo/revgeo lookups http://blog.corynissen.com/2014/10/making-r-package-to-use-here-geocode-api.html and the geocode package has GNfindNearestAddress, so tons of options

Re: [R] help_ReverseGeocoding

2015-07-28 Thread MacQueen, Don
My first guess, after a quick glance, is that Google only lets you do a limited number of lookups within some period of time. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 7/27/15, 10:14 PM, "R-help on behalf of shreya

Re: [R] Compute z

2015-07-28 Thread MacQueen, Don
To which I will add: Start up R. At the prompt, type ?Control This will show you the syntax for 'for' loops. (is this homework?) -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 7/26/15, 8:19 AM, "R-help on behalf of

Re: [R] Writing output of a looped process with pdfs

2015-07-28 Thread MacQueen, Don
Having done this: setwd("/Users/sisolarrosa/Documents/PhD/R_work/AF/IIC/split_fnp/") shps<- dir(getwd(), "*.shp") shps <- gsub('.{4}$', '', shps) You can create the list directly, instead of manually, like this (not tested, and see ?list): fnps <- vector('list', length(shps)) names(fnps) <-

Re: [R] Element-by-element division

2015-07-28 Thread Sarah Goslee
On Tue, Jul 28, 2015 at 9:42 AM, David L Carlson wrote: > apply() will also get you there with almost the same arguments in different > order (plus t()): Sure, there are lots of ways to do everything in R. But mixing in apply muddles the issue, since apply() and sweep() use different logic to de

Re: [R] Element-by-element division

2015-07-28 Thread David L Carlson
apply() will also get you there with almost the same arguments in different order (plus t()): > t(apply(a, 1, "/", b)) [,1] [,2] [1,]2 24 [2,]4 28 [3,]6 32 [4,]8 36 [5,] 10 40 - David L Carlson Department of Anthropology Texas

Re: [R] Global variables

2015-07-28 Thread jpara3
Thanks to all!!! -- View this message in context: http://r.789695.n4.nabble.com/Global-variables-tp4710473p4710483.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see http

Re: [R] Element-by-element division

2015-07-28 Thread Sarah Goslee
Hi, It's a good idea to keep discussion on R-help, so others can participate and the results make it into the archives. On Mon, Jul 27, 2015 at 9:11 PM, Steven Yen wrote: > Thanks Sarah. That serves my need. I however find ?sweep hard to comprehend. Heh. The help makes it seem more complicated

Re: [R] R wont accept my zero count values in the GLM with quasi_poisson dsitribution

2015-07-28 Thread Michael Friendly
On 7/28/2015 3:05 AM, Göran Broström wrote: On 28/07/15 08:33, Charlotte wrote: Hello I have count values for abundance which follow a pattern of over-dispersal with many zero values. I have read a number of documents which suggest that I don't use data transforming methods but rather than I

[R] R and Intel compiler

2015-07-28 Thread W. Miah
Hello, Has anyone compared the performance of R built with the Intel and GNU compilers? The Intel compiler comes with very good vectorisation features which I imagine will run faster for R. Any experiences with both compilers will be appreciated. Best regards, Wadud Miah Sen

[R] Problem to optimize a truncated function with auglag (alabama)

2015-07-28 Thread Siebert
Hello, I use the auglag-command of the alabama package to optimize a function under constraints. The function is truncated at -400. I am afraid, that the auglag-command has problems to maximize this function. The solution found by the auglag-command is not even close to the optimum. It is easy to

[R] Opposite color in R

2015-07-28 Thread Atte Tenkanen
It seems that there is no implementation for the "traditional artist's color circle" in R. However I'm searching for such a wheel, because my program needs it. As said, the description of complementary/opposite-function in package "colortools" is misleading since, for example opposite("green

[R] Stop tkbind

2015-07-28 Thread jpara3
Hi, I´m trying this example from the website(http://www.sciviews.org/_rgui/tcltk/InteractiveTkrPlot.html), but the problem is that i wnat to integrate to it an stop button that stops the tkbind. Can someone please help me? THanks!! The code->>> xCoords<-(-12

Re: [R] Global variables

2015-07-28 Thread Karim Mezhoud
normally that works, BUT <<- is BAD and not accepted in some repositories as Bioconductor. one<-function(){ a<-"variable passed" return(a) } x <- one() two<-function(x){ print(x) } On Tue, Jul 28, 2015 at 1:22 PM, jpara3 wrote: > Hi, I want to pass a variable value from one function to anoth

Re: [R] Global variables

2015-07-28 Thread Jeff Newmiller
Please don't. Function arguments are good... global variables are bad. one <- function(){ result <- list( a="variable passed" ) result } two <- function( v ){ print( v$a ) } x <- one() two( x ) --- Jeff Newmiller

Re: [R] Global variables

2015-07-28 Thread Michael Dewey
In line comments On 28/07/2015 13:22, jpara3 wrote: Hi, I want to pass a variable value from one function to another, but not as a function argument. For this propose I have put <<-, but it doesn´t work. My code: one<-function(){ a<<-"variable passed" } So you have to execute one() first?

[R] Global variables

2015-07-28 Thread jpara3
Hi, I want to pass a variable value from one function to another, but not as a function argument. For this propose I have put <<-, but it doesn´t work. My code: one<-function(){ a<<-"variable passed" } two<-function(){ print(a) } dos() If I execute dos(), then the error message is: Error in p

Re: [R] R wont accept my zero count values in the GLM with quasi_poisson dsitribution

2015-07-28 Thread John Maindonald
A further point to note is that with a log link, SEs for comparisons with any factor level where counts are all zero will be huge and meaningless. This phenomenon has the name Hauck-Donner effect, though more commonly so identified for comparisons with categories with very low or very high estima

Re: [R] Populate data frame for meta-analysis

2015-07-28 Thread Jim Lemon
Hi Jerry, Try this: jl.df<-read.table(text="ID,score,success,failure study1,1,35,85 study1,2,46,83 study2,1,78,246 study2,2,45,96", sep=",", header=TRUE) nrows<-dim(jl.df)[1] jlexp.df<-data.frame() for(row in 1:nrows) { success_rows<-data.frame(ID=rep(jl.df$ID[row],jl.df$success[row]), score=r

Re: [R] write.table with append=T after using cat on same file

2015-07-28 Thread PIKAL Petr
Hi Your example works for me. Error is on your side. Try ?traceback or start with plain R -vanilla or upgrade R. > sessionInfo() R Under development (unstable) (2015-06-15 r68521) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows XP (build 2600) Service Pack 3 locale: [1] LC_COLLA

Re: [R] R load error

2015-07-28 Thread Duncan Murdoch
On 27/07/2015 3:03 PM, Yaacov Petscher wrote: > Greetings - I'm using RStudio and recently updated both it and R. When > loadings up, I'm now receiving the following error: > > Error: ReadItem: unknown type 63, perhaps written by later version of R > > I've tried using rm(list=ls()) rm(list=ls

Re: [R] R wont accept my zero count values in the GLM with quasi_poisson dsitribution

2015-07-28 Thread Göran Broström
On 28/07/15 08:33, Charlotte wrote: Hello I have count values for abundance which follow a pattern of over-dispersal with many zero values. I have read a number of documents which suggest that I don't use data transforming methods but rather than I run the GLM with the quasi poisson distribut

Re: [R] R wont accept my zero count values in the GLM with quasi_poisson dsitribution

2015-07-28 Thread Andrew Robinson
You have selected the binomial family in the call to glm. You should instead try something like family=quasipoisson(link = "log") I hope this helps Andrew On Tue, Jul 28, 2015 at 4:33 PM, Charlotte < charlotte.hu...@griffithuni.edu.au> wrote: > Hello > > I have count values for abundance whi