similar to: replace NA value with 0

Displaying 20 results from an estimated 3000 matches similar to: "replace NA value with 0"

2007 Sep 17
3
data frame
Hi everybody, If I've a data frame like this: dataframe a X0 X2 X4 X6 X8 X10 X12 X14 X16 1957 0 0 0 0 0 0 0 0 0 1958 0 0 0 0 0 0 0 0 0 1959 831 0 0 0 0 0 0 0 0 1960 544 282 0 0 0 0 0 0 0 1961 446 365 0 0 0 0 0 0 0 1962 442 473 0 0 0 0 0 0 0 1963 595 468 0 0 0 0 0 0 0 1964
2009 Jun 23
7
first value...
Hi, I've a vector like this: > inc [1] NA NA NA NA NA NA NA [8] NA NA NA NA NA NA NA [15] NA NA NA NA NA NA NA [22] NA NA NA NA NA NA NA [29] NA NA NA NA
2011 Mar 26
3
round number
Hi, > a <- 4 > a*0.2 [1] 0.8 ok!! Is there a method to obtain this: > a*0.2 [1] 0.80 I need to round the number also with the zero. Thanks in advance, Alfredo
2008 Jun 18
4
inverse cumsum
I've a matrix like this: 1985 1.38 1.27 1.84 2.10 0.59 3.47 1986 1.05 1.13 1.21 1.54 0.21 2.14 1987 1.33 1.21 1.77 1.44 0.27 2.85 1988 1.86 1.06 2.33 2.14 0.55 1.40 1989 2.10 0.65 2.74 2.43 1.19 1.45 1990 1.55 0.00 1.59 1.94 0.99 2.14 1991 0.92
2008 Jun 19
3
colnames of a column
Hi, With this data.frame: > class(rwl) [1] "data.frame" >rwl 0028002F 0028013F 0028032F 1833 3.39 NA NA 1834 3.09 NA NA 1835 3.05 NA NA 1836 3.31 NA NA 1837 2.26 NA NA > colnames(rwl) [1] "0028002F" "0028013F" "0028032F" Ok.... > colnames(rwl[,1]) NULL why??
2008 Jun 24
3
loop with files
I'm trying to make a loop with many files... > library(dplR) > > files <- system("ls *.rwl", intern=TRUE) > > files [1] "cimfasy.rwl" "rocquce.rwl" > for (i in files) {a <- read.rwl(i,header=0)} There are 70 series There are 21 series > class(a) [1] "data.frame" This loop import all the files rwl in a single data.frame ( a
2009 Jun 23
4
vector and NA
Hi, I've a vector like this: ------------------------------------------------------ > inc[,5] [1] NA NA NA NA NA NA NA [8] NA NA NA NA NA NA NA [15] NA NA NA NA NA NA NA [22] NA NA NA NA NA NA
2007 Sep 13
2
loop function
Hi, If I have this values: 21 23 14 58 26 .... How can I sum the values by a progression like this: (21) (21 + 23) (21 + 23 + 14) (21 + 23 + 14 + 58) (21 + 23 + 14 + 58 + 26) (21 + 23 + 14 + 58 + 26....) I've try with the function "loop".... Best Wishes, Alfredo [[alternative HTML version deleted]]
2008 Jun 27
2
NA value
I'm trying to replace NA with 0 value... I've write a loop, but don't work... Where's the problem? > cimfasy_rwl 1991 0.92 0.72 0.50 1.29 0.54 1.22 1992 2.15 1.28 1.23 2.26 1.22 3.17 1993 1.50 0.87 1.68 1.97 0.83 2.55 1994 0.69 0.00 0.76 1.89 0.60 0.87 1995 1.13 1.04
2008 Sep 11
2
count value
Hi, I've this data.frame: > dia X1006109F X1006110F X1006111F X1006112F X1006113F X1006114F X1006115F 1 NA NA NA NA NA 45 NA X1006116F X1006117F X1006118F X1006119F X1006120F X1006122F X1006123F 1 45 NA NA NA 40 NA NA X1006124F X1006125F X1006126F X1006128F X1006203F X1006209F X1006210F
2007 May 09
3
Removing a list of Objects
Hi, I have a simple beginner's question on removing a list of objects. Say I have objects C243.Daily1, C243.Daily2...C243.Daily5 in my workspace. I'd like to remove these without using rm five times. So I write. > a <- list(paste("C243.Daily",sep="",1:5)) > rm(a) Obviously this wouldn't work, as it would only remove the object a. But is there any way
2008 Feb 11
4
Conditional rows
Hi, Given a simple example, test <- matrix(c(0.1, 0.2, 0.1, 0.2, 0.1, 0.1, 0.3, 0.1, 0.1), 3, 3) How to generate row indexes for which their corresponding row values are less than or equal to 0.2 ? For this example, row 2 and 3 are the correct ones. Thanks [[alternative HTML version deleted]]
2011 Nov 22
3
On-demand importing of a package
Dear All, in some functions of my package, I use the Matrix S4 class, as defined in the Matrix package. I don't want to depend on Matrix, however, because my package is perfectly fine without Matrix, most of the functionality does not need Matrix. Matrix is so included in the 'Suggests' line. I load Matrix via require(), from the functions that really need it. This mostly works
2009 Oct 17
2
sum two columns with same value
Hi, I've two dataframe: > snag_totale AREA snag_ha 1 2 1.628128 2 3 10.274249 3 4 2.778503 4 5 73.764307 5 7 12.015985 > log_totale AREA log_ha 1 1 22.29846 2 2 17.16889 3 3 48.80377 4 4 144.18996 5 5 70.30962 6 6 61.81850 7 7 13.24876 > How can I obtain a new data.frame, by the sum of value "snag_ha" +
2011 Jul 07
3
coefficients lm of data.frame
Hi, I've a data frame like this: > as.data.frame(cbind(rnorm(1:12),rnorm(1:12))) V1 V2 1 -1.30849402 -0.52094136 2 0.96157302 0.76217871 3 -0.44223351 -1.72630871 4 -0.10432438 -1.04732942 5 -1.38748914 0.95877311 6 -0.63965975 0.65494811 7 -0.24058318 0.19496830 8 -0.11172988 1.01680655 9 0.08065333 0.22168589 10 0.25196536 0.84619914 11
2008 Jul 11
2
network
Hello I am a relatively new user of R and am struggling to use the 'network' package. I have a correlation matrix (produced using 'cor'), and want to draw a network where each item showing correlation above a threshold (say 0.5) is joined by a green line, and each item showing correlation below a threshold (say -0.5) is joined by a red line. Does anyone have any hints of how to
2008 Jan 11
2
Count unique rows/columns in a matrix
Dear List, i know there are some solutions for this in the archive, but they're not very good for numeric matrices, since they usually convert rows/columns to character strings. Is there an easy way to do $subject for numeric matrices properly, or i need to do it by hand? Thanks, Gabor
2009 Nov 10
1
aggregate data.frame
Hi, I've two data.frame: ind_comp and dati_area > ind_comp INDEX indice 1 1 0.3081856 2 2 0.1368007 3 3 0.1290952 4 4 0.2905484 5 5 0.2686706 6 6 0.1122784 7 7 0.4493264 8 8 0.1932665 9 9 0.1982783 10 11 0.3724666 > dati_area X_COORD Y_COORD DBH AREA ID ind_comp 1 0.0000000 0.0000000 70.0 1 1 0 2
2008 Jan 26
3
Which R version created a package?
Greetings, R-ians: I would like to know which version or R was used to create a given package. I think I remember seeing that topic discussed recently but cannot find it among my notes. Can anyone tell me how to determine which version of R created a package? Thanks. Charles Annis, P.E. <mailto:Charles.Annis@StatisticalEngineering.com> Charles.Annis@StatisticalEngineering.com
2012 Aug 15
3
per-vertex statistics of edge weights
I have a graph with edge and vertex weights, stored in two data frames: --8<---------------cut here---------------start------------->8--- vertices <- data.frame(vertex=c("a","b","c","d"),weight=c(1,2,1,3)) edges <-