similar to: replacing NA's with 0 in a dataframe for specified columns

Displaying 20 results from an estimated 20000 matches similar to: "replacing NA's with 0 in a dataframe for specified columns"

2005 May 10
4
summary statistics for lists of matrices or dataframes
Is there a simple way to calculate summary statistics for all the matrices or dataframes in a list? For example: > z <- list(matrix(c(2,2,2,2), ncol = 2), matrix(c(4,4,4,4), ncol = 2)) > z [[1]] [,1] [,2] [1,] 2 2 [2,] 2 2 [[2]] [,1] [,2] [1,] 4 4 [2,] 4 4 > I would like to calculate, for example, the mean value for each cell. I can do that the hard
2002 Apr 30
2
display of character NA's in a dataframe in 1.5.0
I understand that NA's in character vectors are displayed differently than NA's in factor vectors. > c("x", NA, "y") [1] "x" NA "y" > as.factor(c("x", NA, "y")) [1] x <NA> y Levels: x y That seems sensible enough. But shouldn't I see the same behavior in a dataframe? > test <- data.frame(a =
2006 Jun 14
2
Package naming best practices
R-devel, I'm in the process of choosing a name for a new package. I've already decided that the name will have two parts, 'portfolio' and 'sim', but can't decide between 'portfolioSim' and 'portfolio.sim'. Is there any good reason to choose one over the other? Thanks in advance, Jeff -- Jeff Enos Kane Capital Management jeff at kanecap.com
2007 Mar 15
2
replacing all NA's in a dataframe with zeros...
I've seen how to replace the NA's in a single column with a data frame *> mydata$ncigs[is.na(mydata$ncigs)]<-0 *But this is just one column... I have thousands of columns (!) that I need to do this, and I can't figure out a way, outside of the dreaded loop, do replace all NA's in an entire data frame (all vars) without naming each var separately. Yikes. I'm racking my
2010 Jan 09
4
parsing pdf files
I have a pdf file that I would like to parse into R: http://www.williams.edu/Registrar/geninfo/faculty.pdf For now, I open the file in Acrobat by hand, then save it "as text" and then use readLines(). That works fine but a) I am concerned that some information may be lost and b) I may be doing this a lot, so I would rather have R grab the information from the pdf file directly. So: is
2010 Aug 26
3
reliability of R-Forge?
How reliable is R-Forge? http://r-forge.r-project.org/ It is down now (for me). Reporting "R-Forge Could Not Connect to Database: " I have just started to use it for a project. It has been down for several hours (at least) on different occasions over the last couple of days. Is that common? Will it be more stable soon? Apologies if this is not an appropriate question for R-help. Dave
2010 Aug 26
3
reliability of R-Forge?
How reliable is R-Forge? http://r-forge.r-project.org/ It is down now (for me). Reporting "R-Forge Could Not Connect to Database: " I have just started to use it for a project. It has been down for several hours (at least) on different occasions over the last couple of days. Is that common? Will it be more stable soon? Apologies if this is not an appropriate question for R-help. Dave
2002 Apr 08
2
subsetting with NA's
Hi, I often have large dataframes with many variables and many NA's, from which I would like to subset out some rows. Here is a toy example: > x <- data.frame(a = c("x", "y", "z"), b = c(1, NA, 5)) > x a b 1 x 1 2 y NA 3 z 5 I realize that, if I know the values in x$b that I want to subset, things are easy: > x[x$b %in% c(1),] a b 1 x 1
2006 Aug 28
1
Affiliation Reporting Standards. was: Re: reshape scaling with large numbers of times/rows
After a question on R, Prof Brian Ripley writes: > However, you did not give your affiliation and I do not like giving free > consultancy to undisclosed commercial organizations. Please in future use > a proper signature block so that helpers are aware of your provenance. I have one question and one comment. Question: Are there specific standards about this for R mailing lists? I
2006 May 01
5
Adding elements in an array where I have missing data.
This is a simple question but I cannot seem to find the answer. I have two vectors but with missing data and I want to add them together with the NA's being ignored. Clearly I need to get the NA ignored. na.action? I have done some searching and cannot get na.action to help. This must be a common enough issue that the answer is staring me in the face but I just don't see it. Simple
1999 Apr 09
9
a strange logical bug (PR#162)
In R0.64.0, try as.numeric(is.na(c(NA,NA,1))) as.numeric(c(T,T,F)) Jim -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
2005 Nov 01
4
S4 classes in existing packages
R-devel, I'm interested in looking at some examples of existing R packages that rely heavily on S4 classes to get a feel for varying styles and package organization techniques. Could you recommend any packages that might serve as a good starting point? Thanks in advance, Jeff
2005 Nov 01
4
S4 classes in existing packages
R-devel, I'm interested in looking at some examples of existing R packages that rely heavily on S4 classes to get a feel for varying styles and package organization techniques. Could you recommend any packages that might serve as a good starting point? Thanks in advance, Jeff
2012 May 03
1
NA's when subset in a dataframe
Dear community, I'm having this silly problem. I've a linear model. After fixing it, I wanted to know which data had studentized residuals larger than 3, so i tried this: d1 <- cooks.distance(lmmodel) r <- sqrt(abs(rstandard(lmmodel))) rstu <- abs(rstudent(lmmodel)) a <- cbind( mydata, d1, r,rstu) alargerthan3 <- a[rstu >3, ] And suddenly a[rstu >3, ] has
2009 Dec 15
1
R question type in Moodle
Moodle (www.moodle.org) is an open source course management system, a competitor to Blackboard. I am writing several hundred R questions that will be used within the quiz module in Moodle. Unfortunately, Moodle does not have a built in question type for R. You can read about the different questions types in Moodle here:
2009 Dec 11
1
Sources for open sourced homework questions for R?
Hi, I am teaching a one month class in applied statistics and want to bring my students up to speed in R without devoting much/any lecture time to R instruction. I think that the best way to do this is to provide them with a lot of R questions for homework. These questions would be numerous (there is a lot of material to cover), go from very simple to somewhat complex, and focus on all the
2001 Sep 26
1
Characters vectors, NA's and "" in merges
I often use merge with dataframes that contain character vectors which have elements that are sometimes "NA" (meaning the string NA, not the same thing, obviously, as NA in a numeric or factor vector). For example, the stock ticker for Nabisco was "NA". Unfortunately (for me), it seems like merge insists on inserting "NA" for missing values. My question: Is there some
2012 Nov 08
1
Dataframe,Matrix,Table
Hi for all............... I am having one Dataset. Mode of the dataset is dataframe. I need to add headerline,row and column line. How to do this...Help me to do this.... Thanks Kokila -- View this message in context: http://r.789695.n4.nabble.com/Dataframe-Matrix-Table-tp4648843.html Sent from the R help mailing list archive at Nabble.com.
2001 Sep 28
1
Summary of Characters vectors, NA's and "" in merges
Thanks to Brian Ripley, Gregory Warnes, and Dennis Murphy for considering my problem about "NA" in character strings. The nub of the issue seems to be that you can not have a string with "NA" in it in a character vector in R without it being intrepreted as meaning NA (i.e., not available). The only work-arounds involve renames of various sorts. Perhaps this is more appropriate
2007 Apr 10
3
sas.get problem
I have 3 SAS files all in the directory F:/sas, two data files and a format file : form.ea1.sas7bdat form.ea2.sas7bdat sas.fmts.sas7bdat F is a USB. I am trying import them to R using "sas.get". I have not used SAS since I was downloading data from mainframe and having to write JCL. I had forgotten how bizarre SAS can be. I currently have not even figured out how to load the files