Re: [R] non-numeric argument to binary operator

2017-01-20 Thread Richard M. Heiberger
It looks like you are attempting to divide a number by a formula. > 5 / (a ~ b) Error in 5/(a ~ b) : non-numeric argument to binary operator On Fri, Jan 20, 2017 at 12:18 PM, Zeki ÇATAV wrote: > Hi, > I'm working on following dataset. > > > > dput(uu5) > structure(list(grup = structure(c(1L, 1

[R] non-numeric argument to binary operator

2017-01-20 Thread Zeki ÇATAV
Hi, I'm working on following dataset. > dput(uu5) structure(list(grup = structure(c(1L, 1L, 2L, 2L), .Label = c("1", "2"), class = "factor"), bw_grp = structure(c(1L, 2L, 1L, 2L), .Label = c("0-999", "1000+"), class = "factor"), deaths = c(6L, 13L, 1L, 2L), pop = c(26L, 67L, 41L, 93L), bw = c(500

Re: [R] non-numeric argument to binary operator

2012-12-16 Thread Duncan Murdoch
On 12-12-16 6:56 PM, Shrupa Sumaria wrote: Hello, I wish to carry out the following: factor_classes <- as.factor(sample(c("BM", "SM", "F"), 10, replace = TRUE)) C <- 5 k <- matrix(0, length(factor_classes), 1) for (i in length(factor_classes)) { k[i] <- C*factor_classes[i] } I get

Re: [R] non-numeric argument to binary operator

2012-12-16 Thread Rui Barradas
Hello, Try C*as.integer(factor_classes) And note that you don't need the loop. Hope this helps, Rui Barradas Em 16-12-2012 23:56, Shrupa Sumaria escreveu: > Hello, > > > I wish to carry out the following: > > > factor_classes <- as.factor(sample(c("BM", "SM", "F"), 10, replace = TRUE)) > > > C

[R] non-numeric argument to binary operator

2012-12-16 Thread Shrupa Sumaria
Hello, I wish to carry out the following: factor_classes <- as.factor(sample(c("BM", "SM", "F"), 10, replace = TRUE)) C <- 5 k <- matrix(0, length(factor_classes), 1) for (i in length(factor_classes)) { k[i] <- C*factor_classes[i] } I get the following error message: non-numeric ar

Re: [R] "non-numeric argument to binary operator"

2011-06-15 Thread Peter Langfelder
Write yourself an alternative function to table, for example like this: tableOfGivenLevels = function(x, levels) { n = length(levels) counts = rep(0, n); names(counts) = levels tab = table(x); counts[match(names(tab), levels)] = tab; counts; } x = sample(c(1:4), 20, replace = TRUE) ta

Re: [R] "non-numeric argument to binary operator"

2011-06-14 Thread the_big_kowalski
"Most likely reason is that the number of unique values in the rows of habs is not the same." Yes, I think that is the problem, thank you. How would I write the code to include 0s in the matrix, ie, I want to have a record of when 1, 2, or 3 does not get sampled, to come up with a frequency of e

Re: [R] "non-numeric argument to binary operator"

2011-06-14 Thread Peter Langfelder
Not sure ho to run the code since nn is not defined. Most likely reason is that the number of unique values in the rows of habs is not the same. That makes the tables produced in the apply command of different length and apply returns a list instead of a matrix, which makes the t() or the division

[R] "non-numeric argument to binary operator"

2011-06-14 Thread the_big_kowalski
Hello, For reasons unclear to me I am getting above error message when I change the value of b in the following code: rm(list=ls()) library("Hmisc") set.seed(4) #seems to have an effect on t(apply b=10 pop.props = c(0.6,0.2,0.2) x=matrix(pop.props,nrow=nn,ncol=length(pop.

Re: [R] "non-numeric argument to binary operator" error while reading ncdf file

2010-11-03 Thread David Pierce
Charles Novaes de Santana wrote: > Thank you everybody for the help! The solution of my problem is here: > > http://climateaudit.org/2009/10/10/unthreaded-23/ > > "The mv variable is the designated NA for the variable and it appears that > somebody screwed that up in the file. This workaround worke

Re: [R] "non-numeric argument to binary operator" error while reading ncdf file

2010-11-03 Thread Charles Novaes de Santana
Thank you everybody for the help! The solution of my problem is here: http://climateaudit.org/2009/10/10/unthreaded-23/ "The mv variable is the designated NA for the variable and it appears that somebody screwed that up in the file. This workaround worked for me: Print out the function get.var.n

Re: [R] "non-numeric argument to binary operator" error while reading ncdf file

2010-10-27 Thread Charles Novaes de Santana
Hi, Well, I did it, but all my script was on the first message. I don't have any other variables. I am just reading a NCDF file and trying to read the variable "tasmax", that has values of temperatures. The only "new" information I have is the header of the NCDF file (Spain02D_tasmax.nc), that I

Re: [R] "non-numeric argument to binary operator" error while reading ncdf file

2010-10-27 Thread Charles Novaes de Santana
Thank you for your answer, Jim! I will try it and post what I find. cheers, Charles On Wed, Oct 27, 2010 at 3:46 PM, jim holtman wrote: > put: > > options(error=utils::recover) > > in your script so that when an error occurs you are dropped into the > 'browser' so that you can examine the vari

Re: [R] "non-numeric argument to binary operator" error while reading ncdf file

2010-10-27 Thread jim holtman
put: options(error=utils::recover) in your script so that when an error occurs you are dropped into the 'browser' so that you can examine the variables at that point in time. There are several references on how to use the debugging tools in R that will help you resolve your problem. We can not

[R] "non-numeric argument to binary operator" error while reading ncdf file

2010-10-27 Thread Charles Novaes de Santana
Hi everyone, I am a newbie in R and in this discussion list. I am trying to use R package "ncdf" to read values of temperature from a NCDF file. I did it before to another file using the function "get.var.ncdf", but now there is an error that I can not solve, and I would really appreciate if you c

Re: [R] non-numeric argument to binary operator

2009-02-04 Thread Bill.Venables
February 2009 1:36 PM To: r-help@r-project.org Subject: [R] non-numeric argument to binary operator Hi, I compute the value of xi*xj by "for" loops, this how I try: > x1 <- c(1:3) > x2 <- c(2:4) ### to compute x1*x2 > (paste("x", 1, sep = ""))*(pas

Re: [R] non-numeric argument to binary operator

2009-02-04 Thread markleeds
hi: it's not clear to me what you're trying to do but maybe outer is what you want ? outer(x,y) it takes every value in x and pairs it with every value in y and the default operation is multiply. see details by doing ?outer. On Wed, Feb 4, 2009 at 10:36 PM, cruz wrote: Hi, I compute t

[R] non-numeric argument to binary operator

2009-02-04 Thread cruz
Hi, I compute the value of xi*xj by "for" loops, this how I try: > x1 <- c(1:3) > x2 <- c(2:4) ### to compute x1*x2 > (paste("x", 1, sep = ""))*(paste("x", 2, sep = "")) Error in (paste("x", 1, sep = "")) * (paste("x", 2, sep = "")) : non-numeric argument to binary operator > All comments ar

Re: [R] non numeric argument to binary operator

2008-12-17 Thread Sarah Goslee
I'm not sure what you are trying to do: modulo arithmetic isn't exactly splitting a matrix into 2. Or even remotely. Regardless of the goal, when numbers are shown in quotes, it's a sure sign that R thinks they are strings, and thus non-number, just as the error message (not a warning) states. To

[R] non numeric argument to binary operator

2008-12-17 Thread Baurzhan Aituov
hi i have a huge matrix and want to split it into 2. with the command %%2. but i get this warning message: *"Error in mmat%%2 : non-numeric argument to binary operator*" here's the bit from my matrix: V1 V2 [1,] "Affymetrix:CompositeSequence:ATH1-