search for: numer

Displaying 20 results from an estimated 18792 matches for "numer".

Did you mean: number
2013 Apr 13
1
how to add a row vector in a dataframe
...want both "m1" and "m0" #here the missing values are 0 res1<-sapply(seq_len(ncol(simdata.psm1)),function(i) {x1<-merge(simdata.psm0[,i],simdata.psm1[,i],all=TRUE); x1[is.na(x1)]<-0; x1}) res1[,997:1000] #????? [,1]???????? [,2]???????? [,3]???????? [,4]??????? #x1??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x2??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x3??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x4??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x5??? Numeric,3000 Numeric,3000 Numeric,3000 Numeric,3000 #x6??? Numeric,30...
2012 Apr 25
1
Proper apply function for matrices embedded in lists
...0 0 8 [3,] 0 0 0 2 0 0 9 I generated 1000 permutations of this structure which was then stored in a list-like object (still actually called a matrix) [,1] [,2] [,3] [,4] [,5] [,6] .....[,1000] [1,] Numeric,495 Numeric,495 Numeric,495 Numeric,495 Numeric,495 Numeric,495 [2,] Numeric,495 Numeric,495 Numeric,495 Numeric,495 Numeric,495 Numeric,495 [3,] Numeric,495 Numeric,495 Numeric,495 Numeric,495 Numeric,495 Numeric,495 [4,] Numeric,495 Numeric,495 Numeric,495 Numeric,495 Numeric,495 Numeric,495...
2010 Feb 16
2
Error of Stepwise Regression with number of rows in use has changed: remove missing values?
Howdy, R Grues I have enjoyed R, but I cannot solve one problem easily. Please help my problem. When I tried the R script, I got the following Error. This error results from input data file exported through a Excel spreadsheet software. Error in step(lm(pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + ?: ??number of rows in use has changed: remove missing values? Could you direct me to solve the Error? Thanks in advance, > ############### outputs from R console ############### > pop <- step( + ? ? ? ? ? ? lm(pop.rate ~ as.numer...
2008 Aug 01
2
how to replace NA values in a list
I have a matrix named "spec" (see below), it is a 6x3 matrix, and each element of spec is a list. For example, spec[1,"wavenumber"] is a list, and it contains 1876 numeric numbers and NAs. I want to replace the NAs to zero, but don't know how to change it, the difficulty may be all the elements are of the class list, so it is hard to change. Thank you for your help! matrix spec: wavenumber prescan postscan H001 Numeric,1876 Numeric,1876 Num...
2010 Mar 31
1
as(1:4, "numeric") versus as.numeric(1:4, "numeric")
Hi, > class(as(1:4, "numeric")) [1] "integer" Surprising but an explanation could be that an integer vector being a particular case of numeric vector, this coercion has nothing to do because 1:4 is already numeric. And indeed: > is.numeric(1:4) [1] TRUE > is.numeric(as(1:4, "numeric&qu...
2013 May 29
3
bootstrap
Hi, You might need to check library(boot).? I have never used that before.? So, I can't comment much.? It is better to post on R-help list.? I had seen your postings on Nabble in the past.? Unfortunately those postings were not accepted in R-help.? You have to directly post at ? r-help at r-project.org after registering at: https://stat.ethz.ch/mailman/listinfo/r-help ?
2011 Nov 20
2
Adding two or more columns of a data frame for each row when NAs are present.
...t;,", text = ## to create a data frame + "Q20, Q21, Q22, Q23, Q24 + 0,1, 2,3,4 + 1,NA,2,3,4 + 2,1, 2,3,4") + yy Q20 Q21 Q22 Q23 Q24 1 0 1 2 3 4 2 1 NA 2 3 4 3 2 1 2 3 4 > x <- transform( yy, ############## Example 1 + mySum = as.numeric(Q20) + as.numeric(Q22) + as.numeric(Q24), + myCount = as.numeric(!is.na(Q20))+as.numeric(!is.na(Q21))+as.numeric(!is.na(Q24)) + ) + x Q20 Q21 Q22 Q23 Q24 mySum myCount 1 0 1 2 3 4 6 3 2 1 NA 2 3 4 7 2 3 2 1 2 3 4 8 3 > + x &lt...
2002 Aug 21
1
is.numeric()
Dear R-list I am having troubles understanding how the function is.numeric() works. Any help appreciated. Some commands are given here (the output and my comments are given below) vec <- c(1.4, NA, NA, NA) sapply(vec,FUN=is.numeric) is.numeric(vec[2]) is.na(vec[2]) is.numeric(NA) vec <- c(TRUE, FALSE, NA, NA) sapply(vec,FUN=is.numeric) is.numeric(vec[2]) is.nu...
2015 Dec 12
2
For integer vectors, `as(x, "numeric")` has no effect.
...which will be called whenever a class extends one of the vector types. > It does > as(value, dataClass) > The key point is that the third argument to as(), strict=TRUE by default. So, yes, the change will cause all integer vectors to become double when the class extends "numeric". Generally, strict=TRUE makes sense here and of course changing THAT would open up yet more incompatibilities. > For back compatibility, one would have to have some special code in setDataPart() for the case of integer/numeric. > John > (Historically, the original s...
2015 Dec 19
2
For integer vectors, `as(x, "numeric")` has no effect.
As I tried to say on Dec. 11, there are two levels of "fix": 1. The fix to the complaint in the OP's subject heading is to conform to the default third argument, strict=TRUE: as(1L, "numeric") == 1.0 This generates some incompatibilities, as for classes that extend "numeric". But still leaves class(1.0) "numeric" and typeof(1.0) "double". The workaround for class definitions that really need NOT to coerce integers to double is to define a class un...
2015 Dec 11
3
For integer vectors, `as(x, "numeric")` has no effect.
...0 writes: >> We do need an explicit method here, I think. >> The issue is that as() uses methods for the generic function coerce() but cannot use inheritance in the usual way (if it did, you would be immediately back with no change, since "integer" inherits from "numeric"). >> Copying in the general method for coercing to "numeric" as an explicit method for "integer" gives the expected result: >>> setMethod("coerce", c("integer", "numeric"), getMethod("coerce", c("ANY&q...
2015 Dec 08
2
For integer vectors, `as(x, "numeric")` has no effect.
We do need an explicit method here, I think. The issue is that as() uses methods for the generic function coerce() but cannot use inheritance in the usual way (if it did, you would be immediately back with no change, since "integer" inherits from "numeric"). Copying in the general method for coercing to "numeric" as an explicit method for "integer" gives the expected result: > setMethod("coerce", c("integer", "numeric"), getMethod("coerce", c("ANY", "numeric"...
2015 Dec 04
2
For integer vectors, `as(x, "numeric")` has no effect.
Here's the surprising behavior: x <- 1L xx <- as(x, "numeric") class(xx) ## [1] "integer" It occurs because the call to `as(x, "numeric")` dispatches the coerce S4 method for the signature `c("integer", "numeric")`, whose body is copied in below. function (from, to = "numeric", strict = TRU...
2010 Apr 09
2
How to use tapply for quantile
...te quantiles of a data frame column split up by two factors: # Calculate the quantiles quarts = tapply(gdf$tt, list(gdf$Runway, gdf$OnHour), FUN=quantile, na.rm = TRUE) This does not work: > quarts 04L 04R 15R 22L 22R 27 32 33L 33R 0 NULL Numeric,5 NULL Numeric,5 NULL Numeric,5 NULL Numeric,5 NULL 1 NULL Numeric,5 NULL Numeric,5 NULL NULL NULL Numeric,5 NULL 2 NULL NULL NULL Numeric,5 NULL NULL NULL NULL NULL 3 NULL NULL NULL NULL NULL NULL NULL N...
2010 Apr 30
0
RMySQL and dates
...ame(filetbl), overwrite=T) This creates the table named for the contents of subj...the problem is in the class of the first column, dates. > sapply(filetbl, class) dates trialnum fooddel ethdel trialtime trialtype deliveries "Date" "integer" "numeric" "numeric" "numeric" "numeric" "numeric" food ethanol fcumrec dcumrec rrf rrd "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" > dbGetQu...
2006 Jan 09
3
prod(numeric(0)) surprise
It surprised me that prod(numeric(0)) is 1. I guess if you say (operation(nothing) == identity element) this makes sense, but ?? Looking in the code, this makes sense: basically (s=1; for i=0 to length(x), multiply s by x[i]) -- which comes out to 1. What *should* prod(numeric(0)) produce? I couldn't find the answer...
2005 May 31
3
FW: why is it numeric(0)?
hello,everyone. I have one question: example 1 > x=numeric(0) > y=5 > print(x+y) numeric(0) example 2 > x=numeric(1) > y=5 > print(x+y) [1] 5 why the print(x+y) is numeric(0) at the first example, but the result is 0 at the second example? __________________________________________________ 佈伵伝仮伱佲伔佈G佊伿佅佷仯伃佒佇伖侜伒佢佉伝伨侙佄佫伬伂伝侙佊伿伡侢伾仹伻伵伋伂伌...
2006 Apr 04
2
is.numeric (NA + NA) is TRUE, should be FALSE (PR#8745)
Full_Name: c fillekes Version: Version 2.2.1 (2005-12-20 r36812) OS: Gentoo Linux kernel 2.6.12 Submission from: (NULL) (129.116.71.233) "Not Available" is of course not a numeric: R > is.numeric (NA) [1] FALSE But for some reason, all arithmetic operations on NA's are in fact numeric, even if it's with other NA's. > is.numeric (NA+NA) [1] TRUE > is.numeric (NA^2) [1] TRUE > is.numeric (NA-NA) [1] TRUE > is.numeric (NA*NA) [1] TRUE > is...
2010 Aug 11
1
sem & psych
...# correlations between methods SampleSize <- 500 # Sample size myMaxIter <- 500 # Maximal number of interactions in every model estimation nCond <- length(traitLoads)* length(traitCorrs)* length(methodLoads)* length(methdCorrs) myRes <- as.numeric(gl(nCond, 1, myRep*nCond)) myloadTrait <- as.numeric(gl(length(traitLoads), 1, length(myRes))) mycorrTrait <- as.numeric(gl(length(traitCorrs), length(traitLoads), length(myRes))) myloadMethd <- as.numeric(gl(length(methodLoads), length(traitLoads) * length(traitCorrs), leng...
2016 Jan 05
2
For integer vectors, `as(x, "numeric")` has no effect.
...lled whenever a class extends one of the vector types. > >>> It does >>> as(value, dataClass) >>> The key point is that the third argument to as(), strict=TRUE by default. So, yes, the change will cause all integer vectors to become double when the class extends "numeric". Generally, strict=TRUE makes sense here and of course changing THAT would open up yet more incompatibilities. > >>> For back compatibility, one would have to have some special code in setDataPart() for the case of integer/numeric. > >>> John > >>> (Hist...