Displaying 5 results from an estimated 5 matches for "stangor".
Did you mean:
stanger
2012 Jul 14
3
Can't understand syntax
...stinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide http://www.R-project.org/**
> posting-guide.html <http://www.R-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
--
Charles Stangor
Professor and Associate Chair
[[alternative HTML version deleted]]
2012 Jul 13
2
which() in subset()
Why does the subset not work in the which() version below?
Thank you
v1 <- subset(t1,
version_1==as.character("100-1")
| version_1==as.character("100-2"))
a<-c("100-1", "100-2")
v1 <- subset(t1, which(a==as.character(version_1)) != 0)
[[alternative HTML version deleted]]
2012 Jul 11
1
sapply question
Why does this sapply code change df3 but not df1?
Thanks
df1 <- read.table(text="
cola colb colc cold cole
1 NA 5 9 NA 17
2 NA 6 NA 14 NA
3 3 NA 11 15 19
4 4 8 12 NA 20
", header=TRUE)
df2 <-df1*2
df1
df2
df3 <-sapply(names(df1),function(x) {df1[[x]]<- df2[[x]]})
df1
df3
[[alternative HTML version deleted]]
2012 Jul 11
1
Analyzing subsets
Say I want to perform transformations on row subsets of my dataframe.
Do I have to break the dataframe into subsets, perform the analysis on each
subset, and rbind() them together again?
..or is there another way.
Thank you!
[[alternative HTML version deleted]]
2012 Jul 11
4
Help with loop
Hi,
I have two dataframes:
The first, df1, contains some missing data:
cola colb colc cold cole
1 NA 5 9 NA 17
2 NA 6 NA 14 NA
3 3 NA 11 15 19
4 4 8 12 NA 20
The second, df2, contains the following:
cola colb colc cold cole
1 1.4 0.8 0.02 1.6 0.6
I'm wanting all missing data in df1$cola to be replaced by the value of
df2$cola.