Displaying 20 results from an estimated 10000 matches similar to: "conditionals with String variables"
2018 Jan 14
0
consolidate three function into one
Hi Bert,
Thank you, yes, you are right. I want to consolidate the three functions into one functions by adding more arguments, adding flexibility to accommodate the number of clusters or the number of Kaplan Meier curves generated in one figure. So, I just need to define one function.
Thanks,
Ding
From: Bert Gunter [mailto:bgunter.4567 at gmail.com]
Sent: Sunday, January 14, 2018 9:50 AM
2018 May 11
0
add one variable to a data frame
Sarah's solutions are good, and here's another, even more basic:
tmp1 <- unique(dat1$B)
tmp2 <- seq_along(tmp1)
dat1$C <- tmp2[ match( dat1$B, tmp1) ]
> dat1
N B C
1 1 29_log 1
2 2 29_log 1
3 3 29_log 1
4 4 27_cat 2
5 5 27_cat 2
6 6 1_log 3
7 7 1_log 3
8 8 1_log 3
9 9 1_log 3
10 10 1_log 3
11 11 3_cat 4
12 12 3_cat 4
As a single line
2018 May 11
3
add one variable to a data frame
Hi Sarah,
Thank you so much!! I got your good ideas.
Ding
-----Original Message-----
From: Sarah Goslee [mailto:sarah.goslee at gmail.com]
Sent: Friday, May 11, 2018 11:40 AM
To: Ding, Yuan Chun
Cc: r-help mailing list
Subject: Re: [R] add one variable to a data frame
[Attention: This email came from an external source. Do not open attachments or click on links from unknown senders or
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
I sometimes think people on this list are quite rude to posters.
I'm afraid I'm likely to join in with some rudeness?
1. "Here is some code that works but also doesn't" is probably not going to
get you an answer
2. I provide no information about the data it works on or doesn't
3. I tell you I'm using a load of dependencies, but don't tell you what
4. I refer to
2012 Jan 24
0
Problem training a neural network with "neuralnet" library
Hi,
I am having difficulty in training a neural network using the package "neuralnet". My neural network has 2 input neurons (covariates), 1 hidden layer with 2 hidden neurons and 2 output neurons (responses). I am training my neural network with a dataset that has been transformed so that each column is of type "numeric". The difficulty I am facing is that the responses of
2024 Aug 09
1
a fast way to do my job
Dear R users,
I am running the following code below, the gem751be.rpkm is a dataframe with dim of 751 samples by 35164 variables, 73 phenotypic variables in the furst to 73rd column and 35091 genomic variables or genes in the 74th to 35164th columns. What I need to do is to calculate the residuals for each gene using the simple linear regression model of genelist[i] ~ purity2;
The following
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
I am sorry that I know I should provide a dataset that allows to replicate my problem.
It is a research dataset and quite large, so I can not share.
Both Bert and Tim guessed my problem correctly. I also thought about the conflicting issue between different packages and function masking.
I just hope to that someone has similar experience, so providing me suggestion.
For conflicting issue,
2018 Jan 14
0
consolidate three function into one
FAQ 7.22
You must print a ggplot object, for example with
print(m52.2cluster)
For the FAQ, run the line
system.file("../../doc/FAQ")
in R on your computer.
Open up the resulting filepath in your favorite editor and scroll down to 7.22
On Sun, Jan 14, 2018 at 4:21 PM, Ding, Yuan Chun <ycding at coh.org> wrote:
> Hi Bert,
>
> I am sorry to bother you on weekend.
>
2024 Jul 25
1
please help generate a square correlation matrix
?s 17:39 de 25/07/2024, Yuan Chun Ding via R-help escreveu:
> Hi R users,
>
> I generated a square correlation matrix for the dat dataframe below;
> dat<-data.frame(g1=c(1,0,0,1,1,1,0,0,0),
> g2=c(0,1,0,1,0,1,1,0,0),
> g3=c(1,1,0,0,0,1,0,0,0),
> g4=c(0,1,0,1,1,1,1,1,0))
> library("Hmisc")
> dat.rcorr =
2018 Jan 14
0
consolidate three function into one
HI R users,
I construct dendrogram tree and cut the tree into different clusters, then generate survival curves by the following three functions. All variables are included in an inputfile.
Can you help me to consolidate the following three function into one functions? I thought about using if else function, but not sure how to do it.
Thank you,
Ding
# function to generate RFS
RFS2cluster
2018 Feb 10
1
please help me a little
Hi R Users,
I am very frustrated with the following code. Please do me a favor to run it.
after reading into the test data set (I also pasted the data set below), the first line of code for "res_coxphf" did not work and generated the error code below. but the other three line worked well. the second line for "res_coxphf2" should be the same as the first line; I need to run
2024 Jul 25
1
please help generate a square correlation matrix
HI Rui,
Thank you for the help!
You did not remove a row if zero values exist in both column pair, right?
Ding
From: Rui Barradas <ruipbarradas at sapo.pt>
Sent: Thursday, July 25, 2024 11:15 AM
To: Yuan Chun Ding <ycding at coh.org>; r-help at r-project.org
Subject: Re: [R] please help generate a square correlation matrix
?s 17:?39 de 25/07/2024, Yuan Chun Ding via R-help
2018 Jan 14
2
consolidate three function into one
Hi Bert,
I am sorry to bother you on weekend.
I am still struggling on defining a correct function.
I first defined the function RFS (see below), then run it by provide the two argument.
m52.2cluster <-RFS(inputfile =allinfo_m52, N=2 )
I do not get error message, but no figure displays on screen. I do not know what is going on.
Can you help me a little more on this issue?
Thank you,
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
Hello,
Inline.
?s 19:03 de 12/06/2024, Yuan Chun Ding via R-help escreveu:
> I am sorry that I know I should provide a dataset that allows to replicate my problem.
>
> It is a research dataset and quite large, so I can not share.
>
> Both Bert and Tim guessed my problem correctly. I also thought about the conflicting issue between different packages and function masking.
> I
2024 Jul 25
1
please help generate a square correlation matrix
Hi R users,
I generated a square correlation matrix for the dat dataframe below;
dat<-data.frame(g1=c(1,0,0,1,1,1,0,0,0),
g2=c(0,1,0,1,0,1,1,0,0),
g3=c(1,1,0,0,0,1,0,0,0),
g4=c(0,1,0,1,1,1,1,1,0))
library("Hmisc")
dat.rcorr = rcorr(as.matrix(dat))
dat.r <-round(dat.rcorr$r,2)
however, I want to modify this correlation calculation;
2018 Jan 15
0
consolidate three function into one
That is certainly OK, but you can also just use
print(ggsurvplot(...))
as your final statement.
out <- RFS( ...)
would then return the ggsurvplot object *and* graph it.
Any good R tutorial or a web search will provide more details on function
returns, which you might find useful.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
2024 Jun 12
3
my R code worked well when running the first 1000 lines of R code
Hi R users,
The following code worked well to summarize four data groups in a dataframe for three variables (t_depth, t_alt_count, t_alt_ratio), 12 columns of summary, see attached.
However, after running another 2000 lines of R codes using functions from more than 10 other R libraries, then it only generated one column of summary.
Do you know why?
Thank you,
Yuan Chun Ding
summary_anno1148ft
2018 Jan 15
1
consolidate three function into one
Thank you, your suggestion is simpler and logically better. I had impression that the last object in a function gets returned, so I did not add the print function at the bottom line of the function definition. Returning an object and graph the object are different process, I am a beginner for writing R function and need to find a good guide source about writing R functions. If you know a good
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
Hi Rui,
Thank you very much!
Yes, I verified using real data, it worked correctly as expected after adding tidyr:: to the pivot_longer function and dplyr:: to the group_by and summarize
Function.
I did not know how to assign the tidyr and dplyr to the three functions because I do not really understand well the three functions and just got the code from a google search.
I also tried your
2018 Jan 15
2
consolidate three function into one
Hi Richard,
Thank you so much!! I understand the problem now, I assign a name to the "ggsurvplot" object and then add print(fig) at bottom of function definition, now figure gets printed on screen.
Ding
# function to generate RFS curves
RFS <- function( inputfile, N ) {
cluster<- survfit(Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~ clusters,
data =