Displaying 20 results from an estimated 3000 matches similar to: "Need R code"
2006 Apr 20
2
R-Help
Dear r-users,
Suppose I have three datasets:
Dataset-1:
Date x y
Jan-1,2005 120 230
Jan-2,2005 123 -125
Jan-3,2005 -110 300
Jan-4,2005 114 -21
Jan-7,2005 11 299
Mar-5,2005 200 311
Dataset-2:
Date x y
Jan-2,2005 123 -125
Jan-3,2005 -110 300
Jan-4,2005 114 -21
2002 Oct 24
3
model.matrix (via predict) (PR#2206)
Full_Name: Glenn Stone
Version: 1.5.1 and 1.6.0
OS: win2000
Submission from: (NULL) (168.140.227.9)
The following code produces incorrect fitted values in version 1.5.1 and an
error in 1.6.0
Error in "contrasts<-"(*tmp*, value = "contr.treatment") :
contrasts apply only to factors
In addition: Warning message:
variable ihalf is not a factor in:
2009 Jul 12
1
Booting problem with memdisk + Thinkpad + USB
Hi,
I encountered a booting problem with memdisk 2.83, USB and IBM Thinkpad
T61, apparently the same issue as described here:
http://syslinux.zytor.com/archives/2008-April/009850.html
The boot process always stops after "Loading boot sector... booting...".
With debug tracers enabled, the last few output lines are:
Loading boot sector... FR<p>Dbooting...
2007 May 18
4
Simple programming question
Hi R-users,
I have a simple question for R heavy users. If I have a data frame like this
dfr <- data.frame(id=1:16, categ=rep(LETTERS[1:4], 4),
var3=c(8,7,6,6,5,4,5,4,3,4,3,2,3,2,1,1))
dfr <- dfr[order(dfr$categ),]
and I want to score values or points in variable named "var3" following this
kind of logic:
1. the highest value of var3 within category (variable named
2010 Oct 04
2
i have aproblem --thank you
dear professor:
thank you for your help,witn your help i develop the nomogram successfully.
after that i want to do the internal validation to the model.i ues the bootpred to do it,and then i encounter problem again,just like that.(´íÎóÓÚerror to :complete.cases(x, y, wt) : ²»ÊÇËùÓеIJÎÊý¶¼Ò»Ñù³¤(the length of the augment was different))
i hope you tell me where is the mistake,and maybe i have
1997 Apr 08
1
R-alpha: User friendly functions
A loose idea for *post*-0.50 development
I've been giving a some (but not all that many) thoughts to whether
some of the conceptual difficulties facing newcomers could be avoided
by having simplified functions for common operations. We already have
parts of this, e.g. in Kurts ctest routines. Specifically, I was
thinking about data frames: How about
2011 Jun 29
2
Indexing to Insert values from a dataframe into a matrix
Hello,
I think this is a simple problem but I am not coming up with a simple
solution. I think it just an indexing problem.
I can easily replace values in a matrix from a dataframe when the
dataframe has row and column numbers. In the example below I use row
and column names and I can not get it to work
#make a matrix where rows and columns are the lat and long for a
bounding box of Australia
2007 May 20
2
Number of NA's in every second column
Hi R-users,
How do I calculate a number of NA's in a row of every second column in my
data frame?
As a starting point:
dfr <- data.frame(sapply(x, function(x) sample(0:x, 6, replace = TRUE)))
dfr[dfr==0] <- NA
So, I would like to count the number of NA in row one, two, three etc. of
columns X1, X3, X5 etc.
Thanks in advance
Lauri
[[alternative HTML version deleted]]
2004 Jul 16
3
sas to r
I would be incredibly grateful to anyone who'll help me translate some
SAS code into R code.
Say for example that I have a dataset named "dat1" that includes five
variables: wshed, site, species, bda, and sla. I can calculate with the
following SAS code the mean, CV, se, and number of observations of
"bda" and "sla" for each combination of
2010 Oct 04
1
I have aproblem about nomogram--thank you for your help
dear professor:
I have a problem about the nomogram.I have got the result through analysing the dataset "exp2.sav" through multinominal logistic regression by SPSS 17.0.
and I want to deveop the nomogram through R-Projject,just like this :
> n<-100
> set.seed(10)
> T.Grade<-factor(0:3,labels=c("G0", "G1", "G2","G3"))
>
2008 Mar 06
2
How to hold a value(Mean sq) with a string
Hi all:
Can someone advice me on how to hold the residuals
Mean sq value on a string
so it can be used in other calculations.
I was trying something like this:
Msquare<-dfr$Mean sq but fails..Thanks
dfr <- read.table(textConnection("percentQ
Efficiency
1.565 0.0125
1.94 0.0213
0.876 0.003736
1.027 0.006
1.536 0.0148
1.536 0.0162
2.607 0.02
1.456 0.0157
2.16 0.0103
2006 Apr 20
1
Randomly selecting one row for each factor level [Broadca st]
The following should work:
> dfr.samp <- dfr[tapply(1:nrow(dfr), dfr$x, sample, 1),]
> dfr.samp
x y z
10 a 10 J
2 b 2 B
9 c 9 I
Andy
From: Kelly Hildner
>
> I don't use R much, and I have been unable to figure out how
> to get the
> subset of my data frame that I would like.
>
> For example, if this were my data frame:
>
> > dfr <-
2005 Apr 06
3
looking for a plot function
Dear useRs,
I have a data frame and I want to plot all rows. Each row is
represented as a line that links the values in each column. The plot
looks like this:
dfr <- data.frame(A=sample(1:50,10),B=sample(1:50,10),
C=sample(1:50,10),D=sample(1:50,10))
xa <- 10*1:4
plot(c(10,40),c(0,50))
for (i in 1:nrow(dfr)) {
lines(xa,dfr[i,],pch=20,type="o")
}
Things get more complicated
2011 Mar 28
2
GSoC 2011 Weighting Schemes
Hi, guys
I am Wenjin from Graduate School of Chinese Academy of Science, pursing a
master degree and my current research interests including using Data mining
and Information retrieve technology to analysis software engineering (SE)
data and support SE.
I have great interested in "Weight Schemes" project. and in the last few
days I have learnt some detail about DFR model family by
2001 Oct 31
2
removing duplicated rows from a data.frame
Dear all,
Sorry for the simplicity of the question, but how does one go about removing duplicated rows in a data.frame?
I'm looking for a quick and simple solution, as my data.frames are relatively large (50000 by 50). I've racked my brain and searched the help files and found nothing useful or quick, only duplicated() and unique() which work only work on lists.
Thanks
Gary.
2010 Feb 27
1
Newbie help with ANOVA and lm.
Would someone be so kind as to explain in English what the ANOVA code (anova.lm) is doing? I am having a hard time reconciling what the text books have as a brute force regression and the formula algorithm in 'R'. Specifically I see:
p <- object$rank
if (p > 0L) {
p1 <- 1L:p
comp <- object$effects[p1]
asgn <-
2017 May 31
2
stats::line() does not produce correct Tukey line when n mod 6 is 2 or 3
OTOH,
> sapply(1:9, function(i){
+ sum(dfr$time <= quantile(dfr$time, 1./3., type = i))
+ })
[1] 8 8 6 6 6 6 8 6 6
Only the default (type = 7) and the first two types give the result lines()
gives now. I think there is plenty of reasons to give why any of the other
6 types might be better suited in Tukey's method.
So to my mind, chaning the definition of line() to give sensible
2017 May 31
4
stats::line() does not produce correct Tukey line when n mod 6 is 2 or 3
Seriously, if a method gives a wrong result, it's wrong. line() does NOT
implement the algorithm of Tukey, even not after the patch. We're not
discussing Excel here, are we?
The method of Tukey is rather clear, and it is NOT using the default
quantile definition from the quantile function. Actually, it doesn't even
use quantiles to define the groups. It just says that the groups
2006 Apr 20
1
Randomly selecting one row for each factor level
I don't use R much, and I have been unable to figure out how to get the
subset of my data frame that I would like.
For example, if this were my data frame:
> dfr <- data.frame(x=rep(letters[1:3], 4), y=(1:12), z=(LETTERS[1:12]))
> dfr
x y z
1 a 1 A
2 b 2 B
3 c 3 C
4 a 4 D
5 b 5 E
6 c 6 F
7 a 7 G
8 b 8 H
9 c 9 I
10 a 10 J
11 b 11 K
12 c 12 L
I would like to
2000 Sep 20
1
SV: sample from contingency table
I have had the same problem and I wrote this function
rmulti <- function(n, size, p)
{
NrDim <- length(p)
if(NrDim<2) stop("The simulated variabel has to be at least
2-dimensional")
res <- matrix(data=NA, nrow=n, ncol=NrDim)
p <- p/sum(p)
TempSize <- size
for(i in 1:NrDim)
{
TempP <- p[i]/sum(p[i:NrDim])
TempBin <- rbinom(n=n, size=TempSize,