Displaying 20 results from an estimated 133 matches for "6,3".
Did you mean:
3,3
2006 Oct 03
4
how ot replace the diagonal of a matrix
Dear useRs,
Trying to replace the diagonal of a matrix is not working for me. I
want a matrix with .6 on the diag and .4 elsewhere. The following
code looks like it should work--when I lookk at mps and idx they look
how I want them too--but it only replaces the first element, not each
element on the diagonal.
mps <- matrix(rep(.4, 3*3), nrow=n, byrow=TRUE)
idx <- diag(3)
mps
idx
mps[idx] &l...
2007 May 11
3
how to get column/row info from a dist object?
Dear R users;
Is it possible to get the row and column number of a particular entry
in a dist object?
Let's say that I want to find the position of the value 1.1837 (the
last entry on the dist object below), that is [6,3]. Can I get those
values without transforming the object to a matrix?, i.e. working with
the dist object only.
1 2 3
2 0.23935864
3 0.56655914 0.71923104
4 0.15272561 0.37926989 0.43931332
5 0.17728654 0.13355685 0.73025495
6 0.61783536 0.52055379 1....
2004 Mar 04
2
lattice, different plotting symbols
...ng lattice's
xyplot using code like that below. How do I specify a symbol and color
for the variable 'prob' and different one's for 'll.prob'?
Thanks, Matt
xyplot( prob + ll.prob ~ time.eff |stat.id + time.out ,data = OUT,
allow.multiple = TRUE,
layout = c(6,3), as.table = TRUE ,
panel = function(x,y){panel.abline(h = 0)
panel.xyplot(x,y)},
strip = TRUE,
)
Matt Pocernich
NCAR - Research Applications Program
303-497-8312
2010 Nov 24
1
Par() Variables, Timing, and Resizing
...Further, as the two graphs are related, I want to put a small or even no
margin between the two graphs. I manipulate the mar and oma variables to
this end.
Sadly, I am not getting the results that I want.
> par(mfcol=c(2,1)) # 2 plot window
> par(mar=c(0,4,0,2), oma=c(0,2,0.5,2), pin=c(6,0.5)) # Set all variables
at once for the upper plot
> plot(1:9) # sample upper plot
> par(pin=c(6,3)) # set window size for 2nd plot
> plot(1:9) # sample lower plot
This method produces the two box plots of varying heights, but does not
change the margins....
2019 Feb 16
2
convertir char a double
Hola a todos,
no acierto a convertir una cadena "6,3" en el double 6.3 sin perder la
parte decimal.
Me sirve también que desde el csv lo lea como double, pero lo convierte
siempre a factor y desde ahi lo paso a caracter porque creo que será más
facil.
El caso es que con as.double el resultado sale redondeado y no veo cómo
recuperar los decimal...
2011 May 19
2
balanced panel data
...I need your help to create a code for this.
Thank you very much,
Cecília Carmo
(Universidade de Aveiro)
#My reproducible example:
firm<-sort(rep(1:3,5),decreasing=F)
year<-rep(2000:2004,3)
X<-rnorm(15)
data1<-data.frame(firm,year,X)
data1
firm<-sort(rep(4:6,3),decreasing=F)
year<-rep(2001:2003,3)
X<-rnorm(9)
data2<-data.frame(firm,year,X)
data2
finaldata<-rbind(data1,data2)
finaldata
[[alternative HTML version deleted]]
2005 Mar 21
1
anomalous result for wilcox.exact in exactRankTests
Hi,
In the exactRankTest package, I've become aware that you can get
anomalous p-values (i.e., above 1) from the wilcox.exact method, as in:
> wilcox.exact(c(-0.6,0.8,-0.5))
Exact Wilcoxon signed rank test
data: c(-0.6, 0.8, -0.5)
V = 3, p-value = 1.25
alternative hypothesis: true mu is not equal to 0
This is disturbing. Has anyone encountered this before, and if so is
there an obvious reason why this should happen?
Thanks,
Roger
2007 Oct 25
1
Match and replace between two data.frames
Hi folks,
I have two dataframes like these:
DF <- data.frame(ID=c("AA1234","AB3233","AC4353","AD2345","AE7453"),
CK32344=c(1,3,2,4,1), CK32664=c(2,1,1,2,3), CK33422=c(2,2,1,3,2))
VAL <- data.frame(num=rep(6,3), type=c("CK32344", "CK32664",
"CK33422"), number=c("32","452","234"))
I want to replace the values in DF$CK32344, DF$CK32664 DF$CK33422 with
the corresponding number...
2010 Sep 29
1
graph margins
Hello All,
I am drawing a graph having 18 small graphs inside using par(mfrow = c(6,3))
command. My problem is how to specify the margins of the whole 18 graphs. I
used par(mar=c(6.5, 6.5, 1.5, 1.5)) for each graph separately already but it
does not left any margins for the 'mtext()' for the margins of the whole 18
graphs. Any comments please.
Thanks,
MJK
[[alternative...
2006 Jul 09
6
[PATCH/RFC] klibc/kbuild: use separate kbuild files for each klibc subdirectory
This fixes a long standing issue where it was not possible to
do "make usr/klibc/arch/x86_64/longjmp.o" in the kernel.
The principle is that all .o files to be part of klibc are listed
with klib-y. For each directory a klib.list file is made that specify
all .o file and the final AR then adds all .o files to create libc.a.
This patch introduce the infrastructure and converts x86_...
2010 Aug 04
3
split / lapply over multiple columns
Hi all,
I have a data frame with column over which I would like to run
repeated functions for data analysis. Currently I am only running
recursively over two columns where I column 1 has two states over
which I split and column two has 3 states. The function therefore runs
2 x 3 = 6 times as shown when running the following code:
mydata <- data.frame(userid = c(5, 6, 5, 6, 5, 6), taskid = c(1, 1, 2, 2, 3, 3),
stuff = 11:16)
mydata
mydata <- mydata[with(mydata, order(userid, taskid)), ]
mydata
lapply(split(mydata, mydata[,1]), function(x){
lapply(split(x, x[,2]),...
2007 Feb 09
3
How to count the number of NAs in each column of a df?
...ovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
2005 Sep 16
4
Possible bug in lmer nested analysis with factors
Hello,
Is this a bug in the lmer routine?
> library(lme4)
> ### test case based on rats data from Crawley
> a<-rnorm(36);b<-rep(1:3,each=12);c<-rep(1:2,each=6,3);d<-rep
(1:3,each=2,6)
>
> ### mixed model works when c & d are numeric, lmer assumes they
are factors
> m <- lmer(a ~ b + (1|c/d))
>
> ### but bails out when they are actually specified as factors
> c<-factor(c)...
2008 Jan 11
2
Count unique rows/columns in a matrix
Dear List,
i know there are some solutions for this in the archive,
but they're not very good for numeric matrices, since they
usually convert rows/columns to character strings. Is there
an easy way to do $subject for numeric matrices properly,
or i need to do it by hand?
Thanks,
Gabor
2004 Jul 06
2
Generate a matrix Q satisfying t(Q)%*%Q=Z and XQ=W
...... but I try to do it
in R ;-) :
I would like to generate a matrix Q satisfying (for a given Z, X and W) the
two following conditions:
t(Q)%*%Q=Z (1)
XQ=W (2)
where:
Q is m rows and r columns
X is p rows and m columns
D is p rows and r columns
C is r rows and r columns
with m>p,r
e.g:
m=6,
p=2
r=3
Z=matrix(c(1,.2,.5,.2,1,.45,.5,.45,1),3,3)
X=matrix(c(.1,.3,.5,.6,.2,.1,.8,1,.4,.2,.2,.9),2,6)
W=matrix(c(0,.8,.4,.6,.2,0),2,3)
#Create a matrix satisfying (1) is easy:
A=matrix(runif(18),6,3)
Q1=svd(A)$u%*%chol(Z)
#For the second condition (2), a solution is given by
Q2=A%*%ginv(X%*...
2010 May 13
1
ESP Ghostscrip ...
...K in the input data files and data file 14th is not the
biggest input file.
Here is the code:
for(Br in 1:3)
{
if(Br == 1) B <- "U"
if(Br == 2) B <- "A"
if(Br == 3) B <- "O"
ofn <- sprintf("%s.png", B)
bitmap(ofn, type = "png256", width = 21, height = 30, pointsize = 30, bg =
"white", res = 300) <<<<when I decrease res to 50(res=50), everything is OK
with no error message
par(cex.main = 1.2, cex.lab = 1.8, cex.axis = 1.4)
par(mfrow = c(6,3))
for(C in 1:18)
{
if( ( C + 2 ) %% 3 ==...
2011 Jul 05
3
plotting survival curves (multiple curves on single graph)
...le(main=hazanth[3,1],cex.main=0.9)
# plot for Hiwi
with(hazanth[4,3:7],silsurv(a1=a1,b1=b1,a2=a2,a3=a3,b3=b3));title(main=hazanth[4,1],cex.main=0.9)
# plot for !Kung
with(hazanth[5,3:7],silsurv(a1=a1,b1=b1,a2=a2,a3=a3,b3=b3));title(main=hazanth[5,1],cex.main=0.9)
# plot for Yanomamo
with(hazanth[6,3:7],silsurv(a1=a1,b1=b1,a2=a2,a3=a3,b3=b3));title(main=hazanth[6,1],cex.main=0.9)
# plot for Tsimane
###############################
2010 Jul 20
1
p-values pvclust maximum distance measure
...early always results in p-values above 95%.
I wrote an example programme which demonstrates this effect. I
uploaded a PDF showing the results
Here is the code which produces the PDF file:
-------------------------------------------------------------------------------------
s <- matrix(runif(1600,0,1000), nrow=20)
a.res1 <- pvclust(t(s), method.hclust="complete", method.dist="euclidian",
nboot=500)
a.res2 <- pvclust(t(s), method.hclust="complete", method.dist="maximum",
nboot=500)
a.res3 <- pvclust(t(s), method.hclust="complete",...
2012 May 29
2
use xyplot to plot mean and CI by groups
...symbols to draw individual points, CI and
the lines connect group means from different time points;
2. Add jitters to x axis to allow CIs not be overlapped
Could anyone modify the attached code to achieve this?
Thanks
library(lattice)
set.seed(123)
src <- data.frame(time = rep(c(1, 6, 24), rep(6,3)), trt =
rep(rep(c('C','T'), each=3), 3))
src <- transform(src, x=sqrt(time)+2*(trt=='C')+rnorm(18), trt =
ordered(trt, levels=c('C','T')))
src <- src[-5,]
src$m <- ave(src$x, src[c('time','trt')], FUN = mean)
src$sd <...
2009 Sep 21
2
Four concurrent Markov chains
.... The next stage will be to make the animals move
in reference to each other using a moving average variable. Therefore I
think I need all animals simulated within one subroutine (loop).
I probably haven't explained thie very well but here is the code I have been
working on....
#creation of a 6*6 matrix with the transition probabilities
transitions<-matrix(0,nrow=6,ncol=6); transitions[1,1]<- (0/6);
transitions[1,2]<- (0/6); transitions[1,3]<-(0/6);
transitions[1,4]<-(0/6);transitions[1,5]<-(0/6);
transitions[1,6]<-(6/6);transitions[2,1]<- (1/6);transitions[2,2]&l...