similar to: (a) R capacity and (b) sorting cases in R

Displaying 20 results from an estimated 20000 matches similar to: "(a) R capacity and (b) sorting cases in R"

2013 Oct 30
1
ggplot2 question: keeping the order as in the input data
Hello! I am using ggplot2 (see the code below) to plot the data in 'myplotdata'. The first column of 'myplotdata' is called "att.levels" and contains strings; the second column is called "WTP" and contains numeric values. Notice - I use 'coord.flip()' The command aes(x=att_levels, y=WTP), if I understand correctly, sorts things alphabetically based on
2009 Oct 13
4
replacing period with a space
Dear R-ers! I have x as a variable in a data frame x. x<-data.frame(x=c("aa.bb","cc.dd.ee")) x$x<-as.character(x$x) x I am sorry for such a simple question - but how can I replace all periods in x$x with spaces? sub('.', ' ', x$x) - removes all letters to the left of each period... Thanks a lot for your advice! -- Dimitri Liakhovitski Ninah.com
2008 Jan 22
6
recoding one variable into another - but differently for different cases
Hello, I have 2 variables in my sample Data: Data$A and Data$B Variable Data$A can assume values: 1, 2, 3, and 4. Variable Data$B identifies my cases and can assume values: 1 and 2. I need to recode my variable Data$A into a new variable Data$new such that: People who are Data[Data$B %in% 1, ] are recoded like this: Value on Data$A Value on Data$new 1 +1 2
2010 Mar 04
4
Analogue to SPSS regression commands ENTER and REMOVE in R?
I am not sure if this question has been asked before - but is there a procedure in R (in lm or glm?) that is equivalent to ENTER and REMOVE regression commands in SPSS? Thanks a lot! -- Dimitri Liakhovitski Ninah.com Dimitri.Liakhovitski at ninah.com
2008 Sep 08
7
Question about multiple regression
Dear R-list, maybe some of you could point me in the right direction: Are you aware of any FREE Fortran or Java libraries/actual pieces of code that are VERY efficient (time-wise) in running the regular linear least-squares multiple regression? More specifically, I have to run small regression models (between 1 and 15 predictors) on samples of up to N=700 but thousands and thousands of them. I
2009 Apr 23
4
rbind data frames stored in a list
Hello everyone! I have a list X with 3 elements, each of which is a data frame, for example: a<-data.frame(a=1,b=2,c=3) b<-data.frame(a=c(4,7),b=c(5,8),c=c(6,9)) c<-data.frame(a=c(10,13,16),b=c(11,14,17),c=c(12,15,18)) X<-list() X[[1]]<-a X[[2]]<-b X[[3]]<-c (X) How can I most effectively transform X into a data frame with columns a, b, and c? I would love to find a generic
2009 Mar 26
2
Analogy for %in% for the whole columns (rather than individual values)
Hello! I have a matrix a with 2 variables (see below) that contain character strings. I need to create a 3rd variable that contains True if the value in column x is equal to the value in column y. The code below does it. a<-data.frame(x=c("john", "mary", "mary", "john"),y=c("mary","mary","john","john"))
2009 Sep 23
2
Function to check if a vector contains a given value?
Dear R'rs, is there a function that checks if a given vector contains a certain value. E.g., x<-c(1,2,3,4). How can I get a TRUE or FALSE for whether x contains a 2? -- Dimitri Liakhovitski Ninah.com Dimitri.Liakhovitski at ninah.com
2010 Mar 18
1
R takes long time to open
Hello. Until today I've been using R2.9 and since today R2.10 (on a PC). In both of them it takes about 20 sec for the prompt to appear IN R console after I start R. And every time it says: "Previous saved work space restored" - even if I have not saved any workspace or, in case of R2.10 - even though I have not used it once. In the older versions - R would start within 2-3 sec. Is
2009 Sep 04
2
transforming a badly organized data base into a list of data frames
Dear R-ers! I have a badly organized data base in Excel. Once I read it into R it looks like this (all variables become factors because of many spaces and other characters in Excel):
2009 Feb 11
2
changing settings on a barchart (lattice)
Hello! I apologize - I never used lattice before, so my question is probably very basic - but I just can't find the answer in the archive nor in the documentation: I have a named numeric vector p of 6 numbers (of the type 6 numbers with people's names to whom those numbers belong). I want a simple bar chart. I am doing: library(lattice) trellis.par.set(fontsize=list(text=12)) #
2010 Mar 30
1
Efficiency question: replacing all NAs with a zero
Dear R'ers, I have a very large data frame (over 4000 rows and 2,500 columns). My task is very simple - I have to replace all NAs with a zero. My code works fine on smaller data frames - but I have to deal with a huge one and there are many NAs in each column. R runs out of memory on me ("Reached total allocation of 1535Mb: see help(memory.size)"). Is there any other, more efficient
2009 Sep 17
2
referring to a row number and to a row condition, and to columns simultaneously
Hello, dear R-ers! I have a data frame: x<-data.frame(a=c(4,2,4,1,3,4),b=c(1,3,4,1,5,0),c=c(NA,2,5,3,4,NA),d=rep(NA,6),e=rep(NA,6)) x When x$a==1, I would like to replace NAs in columns d and e with 8 and 9, respectively When x$a != 1, I would like to replace NAs in columns d and e 101 and 1022, respectively. However, I only want to do it for rows 2:5 - while ignoring what's happening in
2010 Mar 30
4
Code is too slow: mean-centering variables in a data frame by subgroup
Dear R-ers, I have a large data frame (several thousands of rows and about 2.5 thousand columns). One variable ("group") is a grouping variable with over 30 levels. And I have a lot of NAs. For each variable, I need to divide each value by variable mean - by subgroup. I have the code but it's way too slow - takes me about 1.5 hours. Below is a data example and my code that is too
2010 Jan 20
5
standardizing one variable by dividing each value by the mean - but within levels of a factor
Hello! I have a data frame with a factor and a numeric variable: x<-data.frame(factor=c("b","b","d","d","e","e"),values=c(1,2,10,20,100,200)) For each level of "factor" - I would like to divide each value of "values" by the mean of "values" that corresponds to the level of "factor" In other
2010 Mar 25
1
Precision level
Hello! I am wondering at what point does R consider a numeric value to be equal to zero - for statements of the type x==0 and x %in% 0. Thank you very much! -- Dimitri Liakhovitski Ninah.com Dimitri.Liakhovitski at ninah.com
2009 Feb 18
1
interaction.plot - gridlines and formatting legend title...
Thank you for providing advice on this graphics question. I am building an interaction.plot. d=data.frame(xx=c(3,3,2,2,1,1),yy=c(4,3,4,3,4,3),zz=c(5.1,4.2,4.4,3.5,3.3,-1.1,-1.3) d[[1]]<-as.factor(d[[1]]) d[[2]]<-as.factor(d[[2]]) print(d) interaction.plot(d$xx, d$yy, d$zz, type="b", col=c("red","blue"), legend=F, lty=c(1,2), lwd=2, pch=c(18,24),
2007 Jul 27
4
Looping through all possible combinations of cases
Hello! I have a regular data frame (DATA) with 10 people and 1 column ('variable'). Its cases are people with names ('a', 'b', 'c', 'd', 'e', 'f', etc.). I would like to write a function that would sum up the values on 'variable' of all possible combinations of people, i.e. 1. I would like to write a loop - in such a way that it
2009 Feb 16
2
Printing out a graph using different graphics devices
Hello, everyone! The code below allows me to produce the graph I want (I know - the colors are strange, but it's just for the sake of an example). After you run the plot<- part and then do print(plot) - that's what I want. However, when I run the bits of code below (with graphics devices) - what they print is different from the original plot. In .png, .emf, and .tiff - my dots change
2009 Feb 13
2
tapply bug? - levels of a factor in a data frame after tapply are intermixed
Hello! I have encountered a really weird problem. Maybe you've encountered it before? I have a large data frame "importances". It has one factor ($A) with 3 levels: 3, 9, and 15. $B is a regular numeric variable. Below I am picking a really small sub-frame (just 3 rows) based on "indices". "indices" were chosen so that all 3 levels of A are present: