Displaying 20 results from an estimated 400 matches similar to: "How to merge string to DF"
2008 Jan 02
3
Find missing days
Hi,
I have a data.frame like this:
y <- rnorm(60)
lev <- gl(3,20, labels=paste("lev", 1:3, sep=""))
date1 <- as.Date(seq(ISOdate(2007,9,1), ISOdate(2007,11,5),
by=60*60*24))
date1 <- date1[-c(3,4,15,34,38,40)]
df <- data.frame(lev=lev, date1=date1, y=y)
I would like to produce a new data.frame with missing days in df$date1
in each df$lev, like this:
lev
2006 Feb 17
1
Transforming results of the summary function
Hi all,
I have a question about transforming the data from summary function.
Let's say I have a data frame like this:
> x = data.frame(a = c(rep("lev1", 5), rep("lev2", 5)), b = c(rnorm(5)+2, rnorm(5)))
> x
a b
1 lev1 1.5964765
2 lev1 2.2945609
3 lev1 3.5285787
4 lev1 1.4439838
5 lev1 2.2948826
6 lev2 1.7063506
7 lev2 -0.4042742
8 lev2
2007 Aug 07
1
Naming Lists
Hi
Im pretty new to R and I have run in to a problem. How do I name all the
levels in this list.
Lev1 <- c("A1","A2")
Lev2 <- c("B1","B2")
Lev3 <- c("C1","C2")
MyList <- lapply(Lev1,function(x){
lapply(Lev2,function(y){
lapply(Lev3,function(z){
paste(unlist(x),unlist(y),unlist(z))
})})})
I would like to name the different
2007 Dec 01
2
How to cbind DF:s with differing number of rows?
#Hi R-users,
#Suppose that I have a data.frame like this:
y1 <- rnorm(10) + 6.8
y2 <- rnorm(10) + (1:10*1.7 + 1)
y3 <- rnorm(10) + (1:10*6.7 + 3.7)
y <- c(y1,y2,y3)
x <- rep(1:3,10)
f <- gl(2,15, labels=paste("lev", 1:2, sep=""))
g <- seq(as.Date("2000/1/1"), by="day", length=30)
DF <- data.frame(x=x,y=y, f=f, g=g)
DF$g[DF$x == 1]
2007 Aug 07
2
Interaction factor and numeric variable versus separate regressions
Dear list members,
I have problems to interpret the coefficients from a lm model involving
the interaction of a numeric and factor variable compared to separate lm
models for each level of the factor variable.
## data:
y1 <- rnorm(20) + 6.8
y2 <- rnorm(20) + (1:20*1.7 + 1)
y3 <- rnorm(20) + (1:20*6.7 + 3.7)
y <- c(y1,y2,y3)
x <- rep(1:20,3)
f <- gl(3,20,
2007 Aug 08
1
tapply grand mean
Hi R-users,
I have a data.frame like this (modificated from
https://stat.ethz.ch/pipermail/r-help/2007-August/138124.html).
y1 <- rnorm(20) + 6.8
y2 <- rnorm(20) + (1:20*1.7 + 1)
y3 <- rnorm(20) + (1:20*6.7 + 3.7)
y <- c(y1,y2,y3)
x <- rep(1:5,12)
f <- gl(3,20, labels=paste("lev", 1:3, sep=""))
d <- data.frame(x=x,y=y, f=f)
and this is how I can
2008 Oct 19
2
definition of "dffits"
R-users
E-mail: r-help@r-project.org
Hi! R-users.
I am just wondering what the definition of "dffits" in R language is.
Let me show you an simple example.
function() {
library(MASS)
xx <- c(1,2,3,4,5)
yy <- c(1,3,4,2,4)
data1 <- data.frame(x=xx, y=yy)
lm.out <- lm(y~., data=data1, x=T)
lev1 <- lm.influence(lm.out)$hat
sig1 <-
2008 May 30
1
nlm and "missing argument
Dear R Gurus,
I am having a little difficulty with nlm. I've searched the archives and
found nothing that tells me why this is occuring -- though there are
some slightly similar issues.
A simple example:
lev2<-function(aaa,bbb,ccc,ddd,eee){
res<-aaa+bbb+ccc+ddd+eee
res
}
nlm(lev2,p=c(32,4,5),ddd=45,eee=23)
Error in f(x, ...) : argument "bbb" is missing, with no default
2007 Dec 02
1
How to recode a factor level (within the list)?
#Dear R-users,
#I have a data.frame like this:
y1 <- rnorm(10) + 6.8
y2 <- rnorm(10) + (1:10*1.7 + 1)
y3 <- rnorm(10) + (1:10*6.7 + 3.7)
y <- c(y1,y2,y3)
x <- rep(1:3,10)
f <- gl(2,15, labels=paste("lev", 1:2, sep=""))
g <- seq(as.Date("2000/1/1"), by="day", length=30)
DF <- data.frame(x=x,y=y, f=f, g=g)
DF$g[DF$x == 1] <- NA
2007 Aug 16
1
Trim trailng space from data.frame factor variables
Hi folks,
I would like to trim the trailing spaces in my factor variables using lapply
(described in this post by Marc Schwartz:
http://tolstoy.newcastle.edu.au/R/e2/help/07/08/22826.html) but the code is
not functioning (in this example there is only one factor with trailing
spaces):
y1 <- rnorm(20) + 6.8
y2 <- rnorm(20) + (1:20*1.7 + 1)
y3 <- rnorm(20) + (1:20*6.7 + 3.7)
y <-
2011 Feb 11
6
linear models with factors
i am trying to fit a linear model with both continuous covariates and
factors. When fitted with the intercept
term the first level of the factor is treated by R as intercept and the
estimate of the effects of remaining levels(say i th level) are given as
true estimate of i th level - estimate of 1st level.can any please help me?
thanks in advance.....
--
View this message in context:
2004 Jan 05
1
lda() called with data=subset() command
Hi
I have a data.frame with a grouping variable having the levels
C,
mild AD,
mod AD,
O and
S
since I want to compute a lda only for the two groups 'C' and 'mod AD' I
call lda with data=subset(mydata.pca,GROUP == 'mod AD' | GROUP == 'C')
my.lda <- lda(GROUP ~ Comp.1 + Comp.2 + Comp.3 + Comp.4+ Comp.5 +
Comp.6 + Comp.7 + Comp.8 ,
2003 Dec 17
2
variance estimates in lme biased?
Hi all,
I didn't get a response to my post of this issue a week ago, so I've
tried to clarify:
When I use lme to analyze a model of nested random effects, the variance
estimates of levels higher in the hierarchy appear to have much more
variance than they should.
In the example below with 4 levels, I simulate variance in level 2
(sd=1.0) and level 4 (sd=0.1), but levels 1 and 3 do
2013 Mar 11
2
how to convert a data.frame to tree structure object such as dendrogram
I have a data.frame object like:
> data.frame(x=c('A','A','B','B'), y=c('Ab','Ac','Ba','Bd'))
x y
1 A Ab
2 A Ac
3 B Ba
4 B Bd
how could I create a tree structure object like this:
|---Ab
A---|
_| |---Ac
|
| |---Ba
B---|
|---Bb
Thanks,
Zech
[[alternative HTML version deleted]]
2002 Dec 27
0
WinXP can't open print queue listing
URL: http://www.tek-tips.com/gviewthread.cfm/lev2/3/lev3/19/pid/865/qid/336795
I have the same problem described in the above posting: using WinXP (he
used Win2K, presumably WinNT does the same thing), you print something, but
the print queue display shows an error message and doesn't show your
job(s). The described solution worked for me too: add to
/etc/samba/smb.conf [global] disable
2000 Mar 22
0
Not being digested, now . . . the question!
Folks,
Thanks to Ricardo Stella and "Chris" for quick assistance, I had sent about 15
help requests to listproc and given up, seeing no sign of a samba-digest list
which is what my majordomo training has taught me. What a strange default
setting . . .
So onto my question about Samba. I've installed the latest RPM from the samba
FTP site (samba-2.0.6-19991110) on a RedHat Linux
2006 Dec 06
3
intercept value in lme
Dear all,
I've got a problem in fitting multilevel model in lme. I don't know to
much about that but suspect that something is wrong with my model.
I'm trying to fit:
m1<-lme(X~Y,~1|group,data=data,na.action=na.exclude,method="ML")
m2<-lme(X~Y+Z,~1|group,data=data,na.action=na.exclude,method="ML")
where:
X - dependent var. measured on a scale ranging from
2005 Aug 04
1
[Bug 2947] stdout with [-v] -H --link-dest and slink/sock/fifo/regf
https://bugzilla.samba.org/show_bug.cgi?id=2947
wayned@samba.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
------- Additional Comments From wayned@samba.org 2005-08-03 16:45 -------
Keep in mind that --link-dest only hard-links regular
2009 Sep 08
7
Data separated by spaces, getting data into R using field lengths
I have a text file similar to this (separated by spaces):
x <- "DF12 This is an example 1 This
DF12 This is an 1232 This is
DF14 This is 12334 This is an
DF15 This 23 This is an example
"
and I know the field lengths of each variable (there is 5 variables in
this data set), which are:
varlength <- c(2, 2, 18, 5, 18)
How can I import this kind of data into R, using the varlength
2008 Feb 21
4
How to get names of a list into df:s?
R users,
I have a simple lapply question.
g <- list(a=1:3, b=4:6, c=7:9)
g <- lapply(g, function(x) as.data.frame(x))
lapply(g, function(x) cbind(x, var1 = rep(names(g), each=nrow(x))[1:nrow(x)]))
I get
$a
x var1
1 1 a
2 2 a
3 3 a
$b
x var1
1 4 a
2 5 a
3 6 a
$c
x var1
1 7 a
2 8 a
3 9 a
And I would like to have
$a
x var1
1 1 a
2 2 a
3 3 a