Displaying 20 results from an estimated 40000 matches similar to: "apply and factor"
2001 Aug 09
2
Pulling columns out of a data.frame
Hi there
Probably a very simple solution to this problem.
I have a character vector eg c("name1","name2","name3") and I want to pull
out these columns from a data.frame, converting each of these columns into
factors also.
Many thanks
Rachel
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2001 Aug 12
1
Creating a Model Matrix - keeping NAs
I am wanting to create a model matrix and keep the NAs.
stratmat <- model.matrix(myformula,mydata)
Is there any way to do this? model.matrix doesn't have na.action as a
parameter. Elsewhere I have made use of na.keep <- function(x){x}.
Many thanks,
Rachel Cunliffe
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2011 Jun 19
4
For loop by factor.
I have a data.frame as follows:
a 3
a 2
a 1
b 3
b 2
c 2
c 3
c 1
c 1
Each factor (a, b, c) should be monotonically decreasing, notice that factor
'c' is not.
I could use some help to figure out how to form a logical structure (mostly
just syntax), that will check each 'next value' for each factor to see if it
is less than the previous value. If it is less than the
2002 May 13
3
Histograms rotated, side-by-side
Hi there,
I am wanting to create 8 side-by-side histograms which have been rotated 90
degrees clockwise from how they usually sit.. all with the same scales. Is
someone able to help me out?
Thanks so much,
Rachel Cunliffe
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send
2001 Feb 28
1
windows() options
Hi
Just noticed that the windows() function doesn't seem to allow for decimals
in the width and height options. For example, typing:
> windows(5,4,10)
> windows(5.2,4,10)
> windows(5.4,4.3,10)
produces three equally sized windows. Is there a way to get around this and
create more accurately sized windows without having to resize by hand?
Thanks
Rachel Cunliffe
Department of
2009 May 07
1
paste with apply, spaces and NA
Hello everyone,
I've come up with a problem with using paste() inside apply() that I
can't seem to solve.
Briefly, if I'm using paste to collapse the rows of a data frame, AND
the data frame
contains strings with spaces, AND there are NA values in subsequent
columns, then
paste() introduces spaces. This only happens with that particular combination of
data values and commands. I have
2009 Jun 20
1
string splitting and testing for enrichment
Hi List
I have data in the following form:
Gene TFBS
NUDC PPARA(1) HNF4(20) HNF4(96) AHRARNT(104) CACBINDINGPROTEIN(149) T3R(167) HLF(191)
RPA2 STAT4(57) HEB(251)
TAF12 PAX3(53) YY1(92) BRCA(99) GLI(101)
EIF3I NERF(10) P300(10)
TRAPPC3 HIC1(3) PAX5(17) PAX5(110) NRF1(119) HIC1(122)
TRAPPC3 EGR(26) ZNF219(27) SP3(32) EGR(32) NFKAPPAB65(89) NFKAPPAB(89) RFX(121)
2007 May 15
2
Anova Test
Hi,
I am very new to R. I am trying to perform an Anova Test and see if it
differs or not.
Basically, i have 4 tests and 1 control.
Tester
Test1 Test2 Test3 Test4 Control
20 25 15 10 17
The inference is at alpha=0.05. they are all independent. I am trying to
find if they differ or the same.
> test1<-c(20)
> test2<-c(25)
> test3<-c(15)
>
2012 Jun 01
1
Drop values of one dataframe based on the value of another
Hello all,
Let me first say that this isn't a question about outliers. I am using
the outlier function from the outliers package but I am using it only
because it is a convenient wrapper to determine values that have the
largest difference between itself and the sample mean. Where I am
running into problems is that I am several groups where I want to
calculate the "outlier" within
2010 Nov 05
4
assignment operator saving factor level as number
Hi all,
I have a dataframe (df1) that I am trying to select values from to a second
dataframe that at the current time is only for the selected items from df1
(df2). The values that I am trying to save from df1 are factors with
alphanumeric names
df1 looks like this:
'data.frame': 3014 obs. of 13 variables:
$ Num : int 1 1 1 2 2 2 3 3 3 4 ...
$ Tag_Num : int 1195
2010 Jun 22
1
subset dataset using factor levels instead of factor names
Hi All,
I have a factor variable with 52 levels -with long, annoying names. I want to keep only rows with some variables. I can do this using this code:
test1 <- subset(nih2009,ic_name %in% c('NATIONAL EYE INSTITUTE','Veterans Affairs'))
dim(test1)
[1] 2396 38
But this doesn't work:
t1 <- subset(nih2009, ic_name %in% c(27,51))
dim(t1)
[1] 0 38
I know
2007 Sep 14
2
Problems with quota dict in 1.1.alpha4
Hello,
there are problems with quota dict when multiple dovecot deliver processes are
launched in parallel. It can be reproduced by sending a mail with multiple
different recipients - the mail is delivered OK to all recipients, but the
quota are not updated correctly in sql. I looked at the code and it seems
that the problem is somewhere in dict cache.
If I configure in Postfix max number of
2010 Jan 15
1
Using multicore with an open pdf device results in corrupt pdf (PR#14186)
The attached code produces corrupted pdfs (test2.pdf, test4.pdf and
test5.pdf). The resulting pdf depends on how many cores are available on
the machine.
I don't see why there should be any difference between the pdfs (exept for
the timestamp). Doing many operations involving mclapply can increase the
size of the resulting pdf by ten times!
Thank you for checking this.
require(multicore)
2010 Jun 03
4
data-management: Rowwise NA
Dear R´ers..
In this mock dataset how can I generate a logical variable based on whether just tes or tes3 are NA in each row??
test<-sample(c("A",NA,"B"),100,replace=T)
test2<-sample(c("A",NA,"B"),100,replace=T)
test3<-sample(c("A",NA,"B"),100,replace=T)
tes<-cbind(test,test2,test3)
2020 Mar 10
4
R CMD INSTALL cannot recognize full path on Windows
Oops, I think both of us forget to cite the r-devel channel.
Best,
Jiefei
On Tue, Mar 10, 2020 at 5:13 AM Wang Jiefei <szwjf08 at gmail.com> wrote:
> Thanks for your quick response, Tomas.
>
> Yes, this is a path issue, I think the problem is related to R, not the
> Rtools make. I built an example package for reproducing the problem:
> https://github.com/Jiefei-Wang/example
2006 Sep 18
2
merge gives me too many rows
Hi,
I am using merge to add some variables to an existing dataframe. I
use the option "all.x=F" so that my final dataframe will only have as
many rows as the first file I name in the call to merge.
With a large dataframe using a lot of "by" variables, the number of
rows of the merged dataframe increases from 177325 to 179690:
>dim(test)
[1] 177325 9
>
2006 Dec 26
2
sequential row selection in dataframe
Dear all;
I'm wondering if there is any 'efficient' approach for selecting a
sample of 'every nth rows' from a dataframe. For example, let's use
the dataframe GAGurine in MASS library:
> length(GAGurine[,1])
[1] 314
# select an 75% of the dataset, i.e. = 236 rows, every 2 rows starting
from row 1
> test<-GAGurine[seq(1,314,2),]
> length(test[,1])
[1] 157
#
2013 Mar 26
3
Samba + ACLs: Can’t add group write permissions
Hi there,
I?ve been trying to get my head around a problem I have with Samba.
I?ve set up Samba 3.6.13 on a Raspberry Pi with Arch Linux ARM on it and
let it serve a couple of folders from an attached external ext4 drive
mounted to /srv/cifs (of course with the "acl" option enabled).
I?ve been trying to create a share that is read-writable for all
members of a particular UNIX user
2001 May 01
2
6 times faster by eliminating apply
This is some kind of follow-up to my previous posts. I have further
improved the speed of my program 6 times by eliminating all the
apply(). It turns out that apply is slow, is slower than direct loop,
it is an order slower than a matrix operation alternative.
Here is one example. The first apply version runs 19 seconds, the
second loop version runs 13 seconds, the third matrix version runs 1
2013 Feb 27
1
metafor - interpretion of QM in mixed-effects model with factor moderator
Hi,
I'm using metafor to perform a mixed-effects meta-analysis. I'd like to
test whether the effect is different for animals and plants/whether "group"
(animal/plant) influences the effect size, but am having trouble
interpreting the results I get. I've read previous posts about QM in
metafor, but I'm still a bit confused. I've dummy-coded the factors: