similar to: remove missing values from matrix or data frame

Displaying 20 results from an estimated 600 matches similar to: "remove missing values from matrix or data frame"

2007 Dec 08
0
help for segmented package
Hi, I am trying to find m breakpoints of a linear regression model. I used the segmented package. It works fine for small number of predicators and breakpoints.(3 r.v. 3 points). However, my model has 14 variables it even would not work even for just one breakpoints!. The error message is always estimated breakpoints are out of range. Since my problem is time related problem. So I
2008 Dec 21
2
data format issue
Dear all- I have a dataset (see a sample below - but the whole dataset is June 2005 - June 2008). The "LST" format is "YYMMDDHHmm" and I would like to get the hourly average of the "mph" for the summer months (spanning all years). I have been trying to use "aggregate" but am not having much success at all! any thoughts would be greatly appreciated.
2008 Nov 21
1
question about shapiro.test()
Hi all! I tried to perform Shapiro-Wilk test for my sample of 243 values. > Us [1] -10.4 -13.1 -12.2 38.1 -18.8 -13.3 -11.7 29.3 49.7 6.8 12.7 16.3 [13] 5.8 -0.7 -29.4 4.1 38.8 -1.4 8.8 15.6 32.9 -5.3 19.1 35.8 [25] 4.0 -1.5 0.6 -4.2 -10.0 -4.0 1.1 48.9 -21.0 -5.3 5.8 -10.8 [37] 21.9 8.2 -3.2 -3.9 -2.3 12.6 -4.7 -8.0 11.8 27.4 -9.5 -20.8 [49]
2012 Sep 04
3
unexpected (?) behavior of sort=TRUE in merge function
All, I realize from the archive that the sort argument in merge has been subject to discussion before, though I couldn't find an explanation for this behavior. I tried to simplify this to (kind of) minimal code from a real example to the following (and I have no doubts that there are smart people around achieving the same with smarter code :-)). I'm running R 2.15.1 64bit under MS Windows
2009 Jun 23
1
ask for help xyplot
I want to make such plot using the following data set plot Mean with Sd(+/-) by Dim group by Lac here is data Does anyone know how to plot using xyploy Thanks, Aimin Mean Sd Var Min Max Dim Lac 704 44.00000 NA NA 44.0 44.0 -30 3 703 45.92000 9.5484030 91.1720000 60.0 34.4 -30 4 702 57.40000 NA NA 57.4 57.4 -30
2009 Aug 13
1
R code to reproduce (while studying) Bates & Watts 1988
Hi R users, I'm here trying to understand correlated residuals in nonlinear estimation. I'm reading/studying the book Bates, D. M. and D. G. Watts, (1988), /Nonlinear regression analysis and its applications/, Wiley, NY. pages 92-94, trying to reproduce the figures and to find out the code in R to perform the necessary calculations. I also consulted Pinheiro and Bates, but without
2008 Oct 16
3
defining a function using strings
Hi All, I need to evaluate a series expansion using Legendre polynomials. Using the 'orthopolinom' package I can get a list of the first n Legendre polynomials as character strings. > library(orthopolynom) > l<-legendre.polynomials(4) > l [[1]] 1 [[2]] x [[3]] -0.5 + 1.5*x^2 [[4]] -1.5*x + 2.5*x^3 [[5]] 0.375 - 3.75*x^2 + 4.375*x^4 But I can't figure out how to
2005 Apr 12
2
not plotting when non-existent
R-help, I'm trying to plot the following: year lgd 1 1986 136.97479 2 1987 69.10377 3 1988 67.66744 4 1989 71.60316 5 1990 62.06897 6 1992 6.25000 7 1993 27.72021 8 1995 23.83648 9 1996 10.29412 10 1997 95.67487 11 1998 82.09367 12 1999 56.60401 13 2000 29.80864 14 2001 23.77535 15 2002 48.30378 16 2003 83.47571 17 2004 74.58711 There are 2 missing years
2008 Nov 20
2
Removing rows with rowsums==0 (I can't figure this out)
##I want to remove the rows where the row sums are zero and this is as far as I have gotten ffg <- (structure(list(CD = c(0, 0, 0, 0, 3.125, 0, 0, 0, 0, 1.6, 3.125, 0, 0, 6.25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.125, 0, 0, 0, 0, 0, 0, 0, 0,
2005 Oct 16
3
Sorting a data frame by one of the variables
Dear all, I have a date frame like this: X Y Z 22 24 4.3 2.3 3.4 5.3 ..... .... 57.2 23.4 34 What my purpose is: to sort the data frame by either X, Y or Z. sample output is (sorted by X) : X Y Z 2.3 3.4 5.3 ..... ...... 22 24 4.3 ... 57.2 23.4 34 I have no idea how to use sort, order or rank functions. Please help me out. Thanks! Leaf
2008 Jan 08
1
using lapply()
useR's, I am trying to find a quick way to change some values in a list that are subject to a condition to be NA. Consider the 3x1 matrix: delta <- matrix(c(2.5,2.5,1), nrow = 1) And consider the list named v that has 3 elements > v v[[1]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 4.25 3.25 2.25 1.25 0.25 0.75 1.75 2.75 3.75 4.25
2010 Sep 03
4
Generation of uniform random numbers
Dear R helpers I have following dataset rate_number = matrix(c(5, 15, 60, 15, 5, 0, 20, 60, 20,0, 10, 20, 40, 20, 10), nrow = 5, ncol = 3) range_mat = matrix(c(6.25, 6.75, 7.25, 8.75, 9.25, 9.75, 8.5, 9, 9.5, 10.5, 11, 11.5, 4.25, 4.75, 5.25, 5.75, 6.25, 6.75), nrow = 6, ncol = 3) > rate_number        [,1]   [,2]   [,3] [1,]    5     0      10 [2,]   15   20      20 [3,]   60   60      40
2011 May 26
2
Plot binomial regression line
Dear all, I am quite new with R and I have a problem with plotting a binomial regression line in a plot. This is what I type in: > model<-glm(Para~Size,binomial) > par(mfrow=c(1,1)) > xv<-seq(3.2,4.5,0.01) > yv<-predict(model,list(area=xv),type="response") > plot(Size,Para) > lines(xv,yv) The error message that I get is: > Error in xy.coords(x, y) :
2009 Oct 26
1
regular expressions
Dear list, I have the following text to parse (originating from readLines as some lines have unequal size), st = c("START text1 1 text2 2.3", "whatever intermediate text", "START text1 23.4 text2 3.1415") from which I'd like to extract the lines starting with "START", and group the subsequent fields in a data.frame in this format: text1 text2
2009 Jun 01
2
add values inside vector
I think it's easy problem but I can't find solution. I have a vector: vec <- c (23.4, 3.0, 14.7, 7.7) and I would like to add all values which are inside my vector to each other. as a result a want to get one value like sum all values from my vector- sth=(23.4 + 3.0 + 14.7 + 7.7) PS. I usually don't know how long is my vector in my function -- View this message in
2003 Mar 31
4
Convert char vector to numeric table
I'm a great fan of read.table(), but this time the data had a lot of cruft. So I used readLines() and editted the char vector to eventually get something like this: " 23.4 1.5 4.2" " 19.1 2.2 4.1" and so on. To get that into a 3 col numeric table, I first just used: writeLines(data,"tempfile")
2010 Dec 07
3
understanding output of tapply/by cumsum
Dear R-users, I have a dataset with categories and numbers. I would like to compute and add cumulative numbers to the dataset. I do not understand the structure of by(...) or tapply(...) output enough to handle it. Here a small example -------------- d<-expand.grid(a=1:5,b=1:3,c=1:2) d$n = 10 * d$a + d$b +0.1* d$c Sn<-by(d$n,list(d$a,d$c),cumsum) str(Sn) --------- List of 10 $ : num
2016 Mar 09
3
Where is opt spending its time?
I am trying to improve my application's compile-time performance. On a given workload, I take 68 seconds to compile some code. If I disable the LLVM code generation (i.e. I will generate IR instructions, but skip the LLVM optimization and instruction selection steps) then my compile time drops to 3 seconds. If I write out the LLVM IR (just to prove that I am generating it) then my compile
2010 Dec 19
8
SSH Console issues with Ubuntu
Hi, When I login to a Ubuntu 10.04 virtual machine instance running in Xen through SSH, the console''s lines are clipped at the middle section of my 15.6" screen. I''ll be glad if somebody can suggest a fix. This is turning out to be very annoying. Thanks, Kowshik _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com
2003 Oct 19
2
problem with win.metafile( ): traceback()
For the first error message: > win.metafile(file = "//.../plot1.wmf", + width = 8.5, height = 6.25) > lset( list( background = list(col = "white"))) Error in get(x, envir, mode, inherits) : variable "win.metafile://.../plot1.wmf" was not found > traceback() 4: get(device) 3: trellis.device(device = .Device, new = FALSE) 2: trellis.par.get(item) 1: