Dear all,
I have a data.frame that includes a series of demographic variables for a
set of respondents plus a dependent variable (Theta). For example:
AgeEducation Marital Familysize
IncomeHousingTheta
1: 50 Ass
> library(latticeExtra)
Loading required package: lattice
Loading required package: RColorBrewer
> t11 <- xyplot(1 ~ 1)
> t11
> c(t11, t11)
Warning message:
In formals(fun) : argument is not a function
> version
_
platform x86_64-w64-mingw32
arch x86_64
os
Try the following (which won't work with factors):
> i <- match(tdat$B, tdat$A)
> newColumns <- tdat[i, c("B", "C")]
> newColumns[is.na(newColumns)] <- "0"
> transform(tdat, D=newColumns[["B"]], E=newColumns[["C"]])
A B CY D E
1 A12 B03 C04 0.70 0 0
2 A23 B05 C06 0.05 0 0
3
Hi Bill,
I put stringsAsFactors = FALSE
still did not work.
tdat <- read.table(textConnection("A B C Y
A12 B03 C04 0.70
A23 B05 C06 0.05
A14 B06 C07 1.20
A25 A23 A12 3.51
A16 A25 A14 2,16"),header = TRUE ,stringsAsFactors = FALSE)
tdat$D <- 0
tdat$E <- 0
tdat$D <- (ifelse(tdat$B %in% tdat$A, td
Use the stringsAsFactors=FALSE argument to read.table when
making your data.frame - factors are getting in your way here.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Wed, Dec 13, 2017 at 3:02 PM, Val wrote:
> Thank you Rui,
> I did not get the desired result. Here is the output from your sc
Thank you Rui,
I did not get the desired result. Here is the output from your script
A B CY D E
1 A12 B03 C04 0.70 0 0
2 A23 B05 C06 0.05 0 0
3 A14 B06 C07 1.20 0 0
4 A25 A23 A12 3.51 1 1
5 A16 A25 A14 2,16 4 4
On Wed, Dec 13, 2017 at 4:36 PM, Rui Barradas wrote:
> Hello,
>
> Here i
Hello,
Here is one way.
tdat$D <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0)
tdat$E <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0)
Hope this helps,
Rui Barradas
On 12/13/2017 9:36 PM, Val wrote:
Hi all,
I have a data frame
tdat <- read.table(textConnection("A B C Y
A12 B03 C04 0.70
A2
Because ifelse is not intended to be an alternative to if ... else. They exist
for different purposes.
(besides the other replies, a careful reading of their help pages, and trying
the examples, should explain the different purposes).
--
Don MacQueen
Lawrence Livermore National Laboratory
7000
Hi all,
I have a data frame
tdat <- read.table(textConnection("A B C Y
A12 B03 C04 0.70
A23 B05 C06 0.05
A14 B06 C07 1.20
A25 A23 A12 3.51
A16 A25 A14 2,16"),header = TRUE)
I want match tdat$B with tdat$A and populate the column values of tdat$A
( col A and Col B) in the newly created columns
HI All,
Sorry to bother you.
I have a data matrix with 1000 genes in rows and 100 samples in columns; I
need to run Cox regression model for each of the 1000 markers. I know how to
run Cox regression model for individual marker. Does anyone know a R package or
method to run Cox model for tho
how could you miss emacs + ess?
On Wed, Dec 13, 2017 at 5:04 AM, Juan Telleria wrote:
> Dear R Community Members,
>
> I would like to add to one article I have written the best Graphical User
> Interfaces the R programming language has.
>
> For the moment I know:
> A) Rstudio.
> B) R Tools for V
Maingo,
See previous discussion below on rbind.na() and cbind.na() scripts:
https://stat.ethz.ch/pipermail/r-help/2016-December/443790.html
You might consider binding first then adding orthogonally.
So rbind.na() then colSums(), OR cbind.na() then rowSums().
Best of luck,
W Michels, Ph.D.
O
On 13/12/2017 10:31 AM, Jinsong Zhao wrote:
Hi there,
I don't know why the following codes are return different results.
> ifelse(3 > 2, 1:3, length(1:3))
[1] 1
> if (3 > 2) 1:3 else length(1:3)
[1] 1 2 3
Any hints?
The documentation in the help page ?ifelse and ?"if" explains it pretty
Without recycling you would get:
u <- c(10, 20, 30)
u + 1
#[1] 11 20 30
which would be pretty inconvenient.
(Note that the recycling rule has to make a special case for when one
argument has length zero - the output then has length zero as well.)
Bill Dunlap
TIBCO Software
wdunlap ti
If Emacs is not asking for starting directory, it is very likely your
init file has this somewhere:
(setq ess-ask-for-ess-directory nil)
On Mon, Sep 11, 2017 at 3:23 PM, Enrico Schumann
wrote:
> On Mon, 11 Sep 2017, Christian writes:
>
>> Hi,
>>
>> I experienced a sudden change in the behavior
ifelse returns the "shape" of the first argument
In your ifelse the shape of "3 > 2" is a vector of length one, so it will
return a vector length one.
Avoid "ifelse" until you are very comfortable with it. It can often burn
you.
On Wed, Dec 13, 2017 at 5:33 PM, jeremiah rounds
wrote:
> ifel
ifelse is vectorized.
On Wed, Dec 13, 2017 at 7:31 AM, Jinsong Zhao wrote:
> Hi there,
>
> I don't know why the following codes are return different results.
>
> > ifelse(3 > 2, 1:3, length(1:3))
> [1] 1
> > if (3 > 2) 1:3 else length(1:3)
> [1] 1 2 3
>
> Any hints?
>
> Best,
> Jinsong
>
> _
Hi there,
I don't know why the following codes are return different results.
> ifelse(3 > 2, 1:3, length(1:3))
[1] 1
> if (3 > 2) 1:3 else length(1:3)
[1] 1 2 3
Any hints?
Best,
Jinsong
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more
Thank you all, some of the best free IDEs are specified in the following
article:
http://www.linuxlinks.com/article/20110306113701179/GUIsforR.html
Plus pluggable IDEs:
A) ESS for Emacs
B) IRkernel for Jupyter notebooks
C) StatET for Eclipse
D) Vim-R for vim
Kind regards,
Juan
[[altern
Hi Zahn,
I thought Shiny package in R was the GUI equivalent for R applications.
Tools such as Rstudio is an IDE (integrated development environment) to me.
Regards,
Gaurang Mehta
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ista Zahn
Sent: 13 December
Hi all,
How can I overlay these two histograms?
ggplot(gg, aes(gg$Alz, fill = gg$veg)) + geom_histogram(alpha = 0.2)
ggplot(tt, aes(tt$Cont, fill = tt$veg)) + geom_histogram(alpha = 0.2)
thanks for any help!
Elahe
__
R-help@r-project.org mailing list
On Dec 13, 2017 6:05 AM, "Juan Telleria" wrote:
Dear R Community Members,
I would like to add to one article I have written the best Graphical User
Interfaces the R programming language has.
For the moment I know:
A) Rstudio.
B) R Tools for Visual Studio.
C) Open Analytics Architect.
Many edi
Dear R Community Members,
I would like to add to one article I have written the best Graphical User
Interfaces the R programming language has.
For the moment I know:
A) Rstudio.
B) R Tools for Visual Studio.
C) Open Analytics Architect.
Are there others worth to mention?
Thank you.
Kind regard
23 matches
Mail list logo