Displaying 20 results from an estimated 54 matches for "ld7631".
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
2009 Sep 24
3
making R print on screen
Hello!
I am running a "for" loop. In the loop I am producing some
intermediary results and asking R to print it (of the type below).
However, I noticed - when the task is complicated and takes a lot of
time, R does not print those intermediary results immediately, but
prints them in batches - or does not print at all until we are done
with the whole calculation.
Is there any way to
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
2007 Apr 11
2
sem is not "taking" the model
A strange problem with sem:
I downloaded the sem library and then, I specified my simple measurement model (below). I highlighted it and ran it. It ran, but it did NOT tell me "22 lines read". And nothing works after that - it looks like it runs, but it does not produce anything...
Did I make a mistake somewhere in the model? (notice, TIME has only 1 indicator - t1, and I fixed t1's
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 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"))
2007 Nov 09
3
Problem with R version 2.6.0
I just installed R 2.6.0 (had R 2.5 before).
Here is my problem. Usually, when I work with R I first go to
"File->Change dir" and browse to a folder that seats OUTSIDE of the
folder "C:\Program Files\R\R-2.6.0" and then create my script there
(and open and re-open it there). I never had any problems with R 2.4
or R 2.5.
However, after I installed R 2.6.0, R crashes every
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 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 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 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
2009 Apr 20
7
Fitting linear models
I am not sure if this is an R-users question, but since most of you here
are statisticians, I decided to give it a shot.
I am using the lm() function in R to fit a dependent variable to a set
of 3 to 5 independent variables. For this, I used the following
commands:
>model1<-lm(function=PBW~SO4+NO3+NH4)
Coefficients:
(Intercept) SO4 NO3 NH4
0.01323 0.01968
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
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
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 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),
2009 Apr 21
0
joined R-today [SELinux]
...could be RedHat Enterprise Linux?).
Contact your sysadm or google for the error message.
(One of the hits suggests that you might need to run
chcon -t texrel_shlib_t ncdf.so
but, well, no warranties...)
>
> Bala
>
>
> On Tue, Apr 21, 2009 at 2:03 PM, Dimitri Liakhovitski <ld7631 at gmail.com>wrote:
>
>> Try to install from scratch from a different mirror.
>> Dimitri
>>
>> On Tue, Apr 21, 2009 at 6:21 AM, Bala subramanian
>> <bala.biophysics at gmail.com> wrote:
>>> Hi,
>>> Yes ncdf needs netcdf, netcdf is already...
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