Displaying 20 results from an estimated 3000 matches similar to: "making R print on screen"
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
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
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 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 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
2009 Oct 01
2
Rd.sty question: LaTeX expert needed
The Rd.sty LaTeX package is used when building the R manuals, and by the
LaTeX pages produced from the man pages.
I have tracked down some problems G?bor Cs?rdi was having recently (see
"Re: [R] preformatted and '#' in manual pages" in R-help) to a LaTeX
problem, and am trying to work out how to fix it.
Specifically, the .Rd file he was using had a structure like
\dQuote{
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
2009 Sep 23
3
retrieve certain part from html
Dear All,
Can someone please guide me how to get the certain part from a long html
language?
e.g.
"<td><a href='2005-01.html'>2005-01</a></td><td><a
href='2006-01.html'>2006-01</a></td><td><a
href='2007-01.html'>2007-01</a></td><td><a
2009 Sep 17
3
How to generate a matrix where each row (or column) is the same vector?
Hi,
I can use the following code to generate a matrix, each column of
which is 'x'. But I have to specify '5' twice in the second command. I
am wondering if there is a better way to do it.
> x=1:10
> matrix(rep(x,5),nc=5)
> t(matrix(rep(x,5),nc=5))
Regards,
Peng
2009 Nov 05
1
combine UserDefinedDatabase and regular environments
Hello,
Is it possible to have the effect of UserDefinedDatabase outside of
"attached" environments ? Can I disguise an environment of the
sys.frames() as a UserDefinedDatabase ?
This seems to suggest that it might be possible :
> f <- function(){ e <- environment(); class(e) <-
"UserDefinedDatabase"; ff }
> f()
*** caught segfault ***
address (nil),
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 May 08
1
Increasing the font size on axes in trellis
Hello,
the code below gives me the picture I need - but there is on small
thing I can't figure out.
The plot has very small tick mark labels for both axes. I don't mean
the axis labels - they are both good, but what is shown near the tick
marks.
Please help me figure out what parameter I should add to make those
larger. I tried sticking cex.lab=1.3 in different places but it didn't
2009 Oct 10
1
isFALSE
Hello,
Just wondering why there is "isTRUE" and not "isFALSE".
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/BcPw : celebrating R commit #50000
|- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
`- http://tr.im/yw8E : New R package : sos
-------------- next part --------------
An
2010 Mar 09
2
looping through predictors
Dear R-ers,
I have a data frame data with predictors x1 through x5 and the
response variable y.
I am running a simple regression:
reg<-lm(y~x1, data=data)
I would like to loop through all predictors. Something like:
predictors<-c("x1","x2",... "x10)
for(i in predictors){
reg<-lm(y~i)
etc.
}
But it's not working. I am getting an error:
Error in
2009 Nov 07
1
getConnection, R_outpstream_st
Hello,
I'm trying to use the limited connections api defined in Rinternals.h. I
have code that looks like this (inspired from do_serializeToConn) :
SEXP serialize_to_connection( SEXP xp, SEXP connection ){
Rconnection con ;
struct R_outpstream_st out;
R_pstream_format_t type = R_pstream_binary_format ;
SEXP (*hook)(SEXP, SEXP) = NULL ;
con = getConnection(Rf_asInteger(connection));
2010 May 05
1
What is the default nPerm for regression in randomForest?
Could not find it in ?randomForest.
Thank you for your help!
--
Dimitri Liakhovitski
Ninah.com
Dimitri.Liakhovitski at ninah.com
2010 Oct 01
3
Suppressing printing in the function
Hello!
I wrote a function that returns a data frame. Nowhere in the function
do I say print(my.data.frame), but when I run the function - the data
frame is printed on the console.
Is there any way to suppress it?
Thank you!
--
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com