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

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

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

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

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

2009-02-04 Thread Bill.Venables
You are making difficulties where there are none. Consider > x1 <- 1:3 # Why c(...)? > x2 <- 2:4 > x12 <- x1*x2 # element by element product (matlab .* operator) > x12 [1] 2 6 12 > x12 <- outer(x1, x2) # another possibility - outer product > x12 [,1] [,2] [,3] [1,]234

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

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