similar to: replace NA´s

Displaying 20 results from an estimated 6000 matches similar to: "replace NA´s"

2020 May 12
4
S3 method dispatch for methods in local environments
Dear All, In R 3.6.3 (and earlier), method dispatch used to work for methods stored in local environments that are attached to the search path. For example: myfun <- function(y) { out <- list(y=y) class(out) <- "myclass" return(out) } print.myclass <- function(x, ...) print(formatC(x$y, format="f", digits=5)) myfun(1:4) # prints: [1]
2003 Dec 04
4
bug in as.POSIXct ?
I think that there is a bug in the as.POSIXct function on Windows. Here is what I get on Win2000, Pentium III machine in R 1.8.1. > dd1 <- ISOdatetime(2003, 10, 26, 0, 59, 59) > dd2 <- ISOdatetime(2003, 10, 26, 1, 0, 0) > dd2 - dd1 Time difference of 1.000278 hours Now, the 26th of October was the day that change to the standard time occurred, so I suspect that this has
2005 Mar 22
1
error with polr()
Dear Sir, I get an error message when I use polr() in MASS package. My data is "ord.dat". I made "y" a factor. y y1 y2 x lx 1 0 0 0 3.2e-02 -1.49485 2 0 0 0 3.2e-02 -1.49485 3 0 0 0 1.0e-01 -1.00000 4 0 0 0 1.0e-01 -1.00000 5 0 0 0 3.2e-01 -0.49485 6 0 0 0 3.2e-01 -0.49485 7 1 1 0 1.0e+00 0.00000 8 0 0 0 1.0e+00 0.00000 9 1 1 0
2012 Nov 23
6
Summary statistics for matrix columns
Hi, is there a way I can calculate a summary statistics for a columns matrix let say we have this matrix x <- matrix(sample(1:8000),nrow=100) colnames(x)<- paste("Col",1:ncol(x),sep="") if I used summary summary(x) i get the output for each column but I need the output to be in matrix with rownames and all the columns beside it this how I want it
2011 Aug 06
1
help with predict for cr model using rms package
Dear list, I'm currently trying to use the rms package to get predicted ordinal responses from a conditional ratio model. As you will see below, my model seems to fit well to the data, however, I'm having trouble getting predicted mean (or fitted) ordinal response values using the predict function. I have a feeling I'm missing something simple, however I haven't been able to
2012 Jul 05
2
vector entry in matix
hi, i'm trying to figure out if there's any possibility to write a whole vector into a matrix or data.frame or something like that. i don't mean transormation. Here an example: [,1] [,2] [1,] "a" "d" [2,] "b" "e" [3,] "c" "f" where e.g. a is a<-c(0,1) vector of length 2, b a vector of length 4,... (i know that
2007 Mar 27
3
Unexpected result of as.character() and unlist() applied to a data frame
Hi, > dd <- data.frame(A=c("b","c","a"), B=3:1) > dd A B 1 b 3 2 c 2 3 a 1 > unlist(dd) A1 A2 A3 B1 B2 B3 2 3 1 3 2 1 Someone else might get something different. It all depends on the values of its 'stringsAsFactors' option: > dd2 <- data.frame(A=c("b","c","a"), B=3:1, stringsAsFactors=FALSE) > dd2
2006 Aug 24
1
Using a 'for' loop : there should be a better way in R
I need to apply a yearly inflation factor to some wages and supply some simple sums by work category. I have gone at it with a brute force "for" loop approach which seems okay as it is a small dataset. It looks a bit inelegant and given all the warnings in the Intro to R, etc, about using loops I wondered if anyone could suggest something a bit simpler or more efficent? Example:
2013 Nov 17
1
FactoMineR
Hola. Como te dijo Carlos, el problema está en los nombres de las columnas y en los nombres de las filas. Cuando hice la importación (con dd<-read.csv('mortality.csv'), tuve problemas con las filas de nombre: - Malignant tumour of the larynx trachea bronchus and lungs - Malignant tumour of the lip pharynx and mouth - Other endocrinological metabolic and nutritional conditions
2012 Aug 06
1
more efficient way to parallel
Dear All, Suppose I have a program as below: Outside is a loop for simulation (with random generated data), inside there are several sapply()'s (10~100) over the data and something else, but these sapply's have to be sequential. And each sapply do not involve very intensive calculation (a few seconds only). So the outside loop takes minutes to finish one iteration. I guess the better way
2009 Mar 04
3
Diff btw percentile and quantile
To calculate Percentile for a set of observations Excel has percentile() function. R function quantile() does the same thing. Is there any significant difference btw percentile and quantile? Regrads, -- View this message in context: http://www.nabble.com/Diff-btw-percentile-and-quantile-tp22328375p22328375.html Sent from the R help mailing list archive at Nabble.com.
2014 Jul 21
2
Inserción de condicionales en pequeño código
Buenas tardes, He construido la función “myfun” al objeto de considerar aquellas persones que a partir de una determinada fecha de Apertura tienen como mínimo 65 años. Se tiene su fecha de nacimiento, su fecha de inicio en la institución y su fecha de salida de la misma. Doy vueltas al script y no acabo se saber cómo poder aplicar de un modo eficiente las instrucciones “if” ó bien “ifelse”, y me
2023 Oct 14
2
Create new data frame with conditional sums
Well, here's one way to do it: (dat is your example data frame) Cutoff <- seq(0, .15, .01) Pop <- with(dat, sapply(Cutoff, \(p)sum(Totpop[Pct >= p]))) I think there must be a more efficient way to do it with cumsum(), though. Cheers, Bert On Sat, Oct 14, 2023 at 12:53?AM Jason Stout, M.D. <jason.stout at duke.edu> wrote: > > This seems like it should be simple but I
2008 Apr 14
3
Doing the right amount of copy for large data frames.
Hi there, Problem :: When one tries to change one or some of the columns of a data.frame, R makes a copy of the whole data.frame using the '*tmp*' mechanism (this does not happen for components of a list, tracemem( ) on R-2.6.2 says so). Suggested solution :: Store the columns of the data.frame as a list inside of an environment slot of an S4 class, and define the '[',
2011 Aug 24
1
silently testing for data from another package for .Rd examples
In an .Rd example for a package, I want to use data from another package, but avoid loading the entire package and avoid errors/warnings if that other package is not available. If I don't care about loading the other package, I can just do: if (require("ElemStatLearn", quietly=TRUE)) { data(prostate) # rest of example } I'd rather just be able to do something like:
2008 Mar 24
1
Great difference for piecewise linear function between R and SAS
Dear Rusers, I am now using R and SAS to fit the piecewise linear functions, and what surprised me is that they have a great differrent result. See below. #R code--Knots for distance are 16.13 and 24, respectively, and Knots for y are -0.4357 and -0.3202 m.glm<-glm(mark~x+poly(elevation,2)+bs(distance,degree=1,knots=c(16.13,24)) +bs(y,degree=1,knots=c(-0.4357,-0.3202
2007 Mar 08
1
chronological scatterplots
Greets Folks, I've been wrestling with how to better control plotting of time data and just can't seem to see the right path. My dataset has thousands of points distributes across a number of years. I would like to plot the responses according to increasing time with nice boundaries - perhaps integer months - along the abscissa. However, the earliest time occurs mid-month and I
2009 May 20
2
How to load data from Statistics Canada
We would like to load data from Statistics Canada (http://www.statcan.gc.ca/) using R, for example, Employment and unemployment rates. It seems to me that the tables are displayed in HTML. I was wondering if you know how to load these tables. Thanks, -james
2006 Mar 11
2
weird! QDA does not depend on priors?
Hi all, If I run LDA on the same data (2-class classification) with default(no priors specified in the lda function) vs. "prior=c(0.5, 0.5)", the results are different. The (0.5, 0.5) priors give better 1-classify-to-1 rate, and the proportional priors(default, no priors specified in the lda function) give better 0-classify-to-0 rate, for both training and testing data sets. However,
2003 Aug 07
2
Question about 'NA'
Hi all, Ive got a database with 10 columns (different variables) for 100 subjects, each column with different # of NA's. I'd like to know if it is possible to use a function to exclude the NA's using only a specific column, lets say: Data2 <- omit.exclude(Data1$column1) ??, then Data3 <- omit.exclude(Data1$column2) and so on I tried the code above but with no results Thanks