Re: [R] Changing sign of columns and values

2022-06-13 Thread anteneh asmare
Dear Jim,  Good morning, hope you are doing very well, Here I want to
calculate the specific parameters based on the previous data. I have
attached below.
can you help me  with r functions or code to solve the above equations
Kind regards,
Hana


On 6/13/22, Jim Lemon  wrote:
> Hi Hana,
> This is a bit more difficult, but the same basic steps apply. See the
> comments for an explanation.
> When you submit a problem like this, it is a lot easier if you send
> the output from "dput" (e.g. dput(df1)) or set your data frames up
> with "read.table" like I have done in the example below. It make it
> lots easier for anyone who wants to reply to see what your dataset
> looks like and input that dataset to devise a solution.
> I have made some assumptions about marking the rows to be altered and
> the arithmetic to do on those rows. What follows may not be as general
> a solution as you want:
>
> df1<-read.table(text=
>  "SNPID OAEA
>  snp001C A
>  snp002G A
>  snp003C A
>  snp004G A
>  snp005C T",
>  header=TRUE,stringsAsFactors=FALSE)
>
> df2<-read.table(text=
>  "SNPID   OAEA   id1 id2 id3 id4 id5
>  snp001AC1.012   0.971.971.99
>  snp002AG1.022   1   2   2
>  snp003CA1   1.032   0   1
>  snp004AG1.021.992   1.021.98
>  snp005CT1   0   1.011   1",
>  header=TRUE,stringsAsFactors=FALSE)
>
> # get a logical vector of the different XA values
> reversals<-df1$EA != df2$EA | df1$OA != df2$OA
> reversals
>
> # set a variable to the maximum value of idx
> # just to make the code easier to understand
> maxid<-2
>
> # create a copy of df2
> dfnew<-df2
>
> # now swap the XA columns and reflect the
> # idxx values of the rows in which
> # EA and OA are different between df1 and df2
> # here I have looped through the rows
> nrows<-dim(dfnew)[1]
> idcols<-4:8
> XAcols<-2:3
> for(i in 1:nrows) {
>  if(reversals[i]) {
>   dfnew[i,XAcols]<-rev(dfnew[i,XAcols])
>   dfnew[i,idcols]<-maxid-dfnew[i,idcols]
>  }
> }
>
> dfnew
>
> Jim
>
> On Mon, Jun 13, 2022 at 12:09 AM anteneh asmare 
> wrote:
>>
>> Dear Jim, Morning I have the same issue regarding comparing and
>> swapping the value of columns fro two different data frames.
>> I have the following two data frames
>> Data frame 1
>> "SNPID" "OA""EA"
>> "snp001""C" "A"
>> "snp002""G" "A"
>> "snp003""C" "A"
>> "snp004""G" "A"
>> "snp005""C" "T"
>>
>> Data frame 2
>> SNPID   OA  EA  id1 id2 id3 id4 id5
>> snp001 AC1.01  2
>> 0.97
>>   1.971.99
>> snp002A G1.02 2
>> 1
>>  22
>> snp003C A 1  1.03
>>  2
>>   01
>> snp004   A  G  1.021.99
>>   2
>>  1.02   1.98
>> snp005  C   T10
>>   1.01
>> 1   1
>>
>> I want to  if  OA s and EAs in data frame 2 is the same as OAs and EAs
>>  data frame 1 in such case I want to keep all information in data
>> fram2 as it is . However if   OA s and EAs in data frame 2 is
>> different from OAs and EAs  data frame 1, I want to change OA s and
>> EAs in data frame 2 to  OAs and EAs  data frame 1 and   I want to
>> redefine the values of the dosages (ids) of the variant (the dosage d
>> for the i-th individual and the j-th variant would become d_ij
>> new=2-dij.
>> Dosage [j,]=2-dosage[j,]
>> My desire data frame looks like
>> Dataframe new
>> SNPID"  "OA"   "EA"id1  id2 id3 id4 id5
>> "snp001""C" "A" 2-1.012- 22-0.97
>> 2-1.97
>> 2-1.99
>> "snp002""G" "A" 2- 1.02  2- 2
>>  2-1
>>   2-2 2- 2
>> "snp003""C" "A"   11.03
>>  2
>> 0  1
>> "snp004""G" "A" 2-1.02   2-1.99
>> 2-22-1.022-1.98
>> "snp005""C" "T"  10
>> 1.01   11
>>  can you help me the r code for the above.
>> Kind regards,
>> Hana
>>
>>
>> On 6/12/22, hanatezera  wrote:
>> > Dear Jim, Thanks a lot this is exactly i am looking for.Stay safe and
>> > blessed !Best,Hana
>> >  Original message From: Jim Lemon
>> > 
>> > Date: 6/12/22  6:43 AM  (GMT+03:00) To: hanatezera
>> > 
>> > Cc: r-help mailing list  Subject: Re: [R]
>> > Changing
>> > sign of columns and values Hi Hana,I didn't look closely. The simplest
>> > rule
>> > that I can see is 

[R] Kindly please help

2022-06-13 Thread Muhammad Zubair Chishti
Hi, Dear Respected Professor! I hope that you are doing well. Kindly help
me with the following:

I have the R-codes for the "Quantile Augmented Mean Group" method. The
relevant codes and data are attached herewith.
Note: The link to the reference paper is:
https://www.econ.cam.ac.uk/people-files/emeritus/mhp1/fp20/qmg40-rev21.pdf
My Issue:
When I run the given codes to estimate the results for my own data. I have
to face several errors. I humbly request the experts to help me to estimate
the results for my data.
Thank you so much for your precious time.

Regards

Muhammad Zubair Chishti
Ph.D. Student
School of Business,
Zhengzhou University, Henan, China.
My Google scholar link:
https://scholar.google.com/citationshl=en&user=YPqNJMwJ
My ResearchGate link: https://www.researchgate.net/profile/Muhammad-Chishti
rm(list = ls())
#   
date()
sessionInfo()
#
# MONTE CARLO EXPERIMENT 4
##
##
# Libraries
##
library(quantreg)
library(splines)
library(SparseM)
#library(plm)
library(MASS)
##
# Functions
##
source("rq.fit.panel.all.revised.R")
#
# Data
##
n <- c(100,100,100,200,200,200)
m <- c(50,100,200,50,100,200)

#n <- c(100,100,100)
#m <- c(50,100,200)

S = 200

R <- 400

lambda = 0.5
beta1 = 1
beta2 = 0.5
rho_x = 0.8
rho_f = 0.9
rho_x_scale = sqrt(1-rho_x^2)
rho_f_scale = sqrt(1-rho_f^2)
z0 = 0
f0 = 0

delta = 0.1

Egamma = 0.5
Vgamma = 1
Evartheta = 0.5
Vvartheta = 1
Emu = 0.5
Vmu = 1

GeoLambda <- array(NA,c(length(S)))

MG.F00 <- array(0,c(3,R,length(n)))
MG.G00 <- array(0,c(3,R,length(n)))
DYN.F00 <- array(0,c(3,R,length(n)))
DYN.G00 <- array(0,c(3,R,length(n)))

set.seed(14)

for (ii in 1:length(n))
{
#ii=i=1
s <- rep(1:n[ii],each=m[ii])
st <- rep(1:m[ii],n[ii])

for(i in 1:R){
z1it <- z2it <- y0 <- Y <- YL1 <- YL2 <- u <- NULL

deltai <- rep(runif(n[ii],0,0.2),each=(m[ii]+S))
sigmai <- rep(runif(n[ii],0.9,1.1),each=(m[ii]+S))

for(t in 1:(m[ii]+S))
{
# f
if(t==1){f1 <- f0}
if(t!=1){f1 <- rbind(f1,rho_f * f1[t-1] + rho_f_scale * 
rnorm(1))}

if(t==1){f2 <- f0}
if(t!=1){f2 <- rbind(f2,rho_f * f2[t-1] + rho_f_scale * 
rnorm(1))}


}

f1 <- rep(f1,n[ii])
f2 <- rep(f2,n[ii])

for(j in 1:n[ii])
{
for(t in 1:(m[ii]+S))
{
if(t==1){z1 <- z0}
if(t!=1){z1 <- rbind(z1,rho_x * z1[t-1] + rho_x_scale * 
rnorm(1))}

if(t==1){z2 <- z0}
if(t!=1){z2 <- rbind(z2,rho_x * z2[t-1] + rho_x_scale * 
rnorm(1))}

}
z1it <- c(z1it,z1)
z2it <- c(z2it,z2)

}

mu <- sqrt(Vmu)*rnorm(n[ii],Emu)
mu <- rep(mu,each=(m[ii]+S))

vartheta <- sqrt(Vvartheta)*rnorm(n[ii],Evartheta)
vartheta <- rep(vartheta,each=(m[ii]+S))

x1 <- mu + vartheta * f1 + z1it
x2 <- mu + vartheta * f2 + z2it

X1 <- matrix(x1,m[ii]+S,n[ii])
X1S <- X1[c(1:S),]
X1T <- X1[-c(1:S),]

X2 <- matrix(x2,m[ii]+S,n[ii])
X2S <- X2[c(1:S),]
X2T <- X2[-c(1:S),]

x1bar <- rep(apply(X1T,2,mean),each=m[ii])
x2bar <- rep(apply(X2T,2,mean),each=m[ii])

gamma1 <- sqrt(Vgamma)*rnorm(n[ii],Egamma)
gamma1 <- rep(gamma1,each=(m[ii]+S))
gamma2 <- sqrt(Vgamma)*rnorm(n[ii],Egamma)
gamma2 <- rep(gamma2,each=(m[ii]+S))

Gamma1 <- matrix(gamma1,m[ii]+S,n[ii])
gamma1T <- c(Gamma1[-c(1:S),])
Gamma2 <- matrix(gamma2,m[ii]+S,n[ii])
gamma2T <- c(Gamma2[-c(1:S),])

U <- sigmai * (1 + deltai * x1) * rnorm( (m[ii]+S) * n[ii] )

epsilon <- gamma1 * f1 + gamma2 * f2 + U
Epsilon <- matrix(epsilon,m[ii]+S,n[ii])
epsilonS <- Epsilon[c(1:S),]
epsilonT <- Epsilon[-c(1:S),]

F1 <- matrix(f1,m[ii]+S,n[ii])
F1S <- F1[c(1:S),]
F1T <- F1[-c(1:S),]

F2 <- matrix(f2,m[ii]+S,n[ii])
F2S <- F2[c(1:S),]
F2T <- F2[-c(1:S),]

f1bar <- rep(apply(F1T,2,mean),each=m[ii])
f2bar <- rep(apply(F2T,2,mean),each=m[ii])

U <- matrix(U,m[ii]+S,n[ii])
US <- U[c(1:S),]
UT <- U[-c(1:S),]

ubar <- rep(apply(UT,2,mean),each=m[ii])

alpha <- x1bar + gamma1T * f1bar + ubar + rep(rnorm(n[ii]),each=m[i

Re: [R] Changing sign of columns and values

2022-06-13 Thread anteneh asmare
Dear, Jim I try the following codes but I got an error
Dfm1<-data.table(Dfm1)
# the names of the columns to be multiplied by BETA
ID_names <- paste0("ID",4:8)
# the names of the new columns that have been multiplied by beta
new_ID_names <- paste0("new_",ID_names)
# Now with a simple command we get the desired multiplication
datfm[, (new_ID_names) := .SD *BETA, .SDcols = ID_names]
datfm
str(datfm)
# The PRS for each individual can be calculated using the colSums
function in base R:
PRS<-Dfm1[, colSums(.SD), .SDcols = new_ID_names]
PRS

On 6/13/22, anteneh asmare  wrote:
> Dear Jim,  Good morning, hope you are doing very well, Here I want to
> calculate the specific parameters based on the previous data. I have
> attached below.
> can you help me  with r functions or code to solve the above equations
> Kind regards,
> Hana
>
>
> On 6/13/22, Jim Lemon  wrote:
>> Hi Hana,
>> This is a bit more difficult, but the same basic steps apply. See the
>> comments for an explanation.
>> When you submit a problem like this, it is a lot easier if you send
>> the output from "dput" (e.g. dput(df1)) or set your data frames up
>> with "read.table" like I have done in the example below. It make it
>> lots easier for anyone who wants to reply to see what your dataset
>> looks like and input that dataset to devise a solution.
>> I have made some assumptions about marking the rows to be altered and
>> the arithmetic to do on those rows. What follows may not be as general
>> a solution as you want:
>>
>> df1<-read.table(text=
>>  "SNPID OAEA
>>  snp001C A
>>  snp002G A
>>  snp003C A
>>  snp004G A
>>  snp005C T",
>>  header=TRUE,stringsAsFactors=FALSE)
>>
>> df2<-read.table(text=
>>  "SNPID   OAEA   id1 id2 id3 id4 id5
>>  snp001AC1.012   0.971.971.99
>>  snp002AG1.022   1   2   2
>>  snp003CA1   1.032   0   1
>>  snp004AG1.021.992   1.021.98
>>  snp005CT1   0   1.011   1",
>>  header=TRUE,stringsAsFactors=FALSE)
>>
>> # get a logical vector of the different XA values
>> reversals<-df1$EA != df2$EA | df1$OA != df2$OA
>> reversals
>>
>> # set a variable to the maximum value of idx
>> # just to make the code easier to understand
>> maxid<-2
>>
>> # create a copy of df2
>> dfnew<-df2
>>
>> # now swap the XA columns and reflect the
>> # idxx values of the rows in which
>> # EA and OA are different between df1 and df2
>> # here I have looped through the rows
>> nrows<-dim(dfnew)[1]
>> idcols<-4:8
>> XAcols<-2:3
>> for(i in 1:nrows) {
>>  if(reversals[i]) {
>>   dfnew[i,XAcols]<-rev(dfnew[i,XAcols])
>>   dfnew[i,idcols]<-maxid-dfnew[i,idcols]
>>  }
>> }
>>
>> dfnew
>>
>> Jim
>>
>> On Mon, Jun 13, 2022 at 12:09 AM anteneh asmare 
>> wrote:
>>>
>>> Dear Jim, Morning I have the same issue regarding comparing and
>>> swapping the value of columns fro two different data frames.
>>> I have the following two data frames
>>> Data frame 1
>>> "SNPID" "OA""EA"
>>> "snp001""C" "A"
>>> "snp002""G" "A"
>>> "snp003""C" "A"
>>> "snp004""G" "A"
>>> "snp005""C" "T"
>>>
>>> Data frame 2
>>> SNPID   OA  EA  id1 id2 id3 id4 id5
>>> snp001 AC1.01  2
>>> 0.97
>>>   1.971.99
>>> snp002A G1.02 2
>>> 1
>>>  22
>>> snp003C A 1  1.03
>>>  2
>>>   01
>>> snp004   A  G  1.021.99
>>>   2
>>>  1.02   1.98
>>> snp005  C   T10
>>>   1.01
>>> 1   1
>>>
>>> I want to  if  OA s and EAs in data frame 2 is the same as OAs and EAs
>>>  data frame 1 in such case I want to keep all information in data
>>> fram2 as it is . However if   OA s and EAs in data frame 2 is
>>> different from OAs and EAs  data frame 1, I want to change OA s and
>>> EAs in data frame 2 to  OAs and EAs  data frame 1 and   I want to
>>> redefine the values of the dosages (ids) of the variant (the dosage d
>>> for the i-th individual and the j-th variant would become d_ij
>>> new=2-dij.
>>> Dosage [j,]=2-dosage[j,]
>>> My desire data frame looks like
>>> Dataframe new
>>> SNPID"  "OA"   "EA"id1  id2 id3 id4 id5
>>> "snp001""C" "A" 2-1.012- 22-0.97
>>> 2-1.97
>>> 2-1.99
>>> "snp002""G" "A" 2- 1.02  2- 2
>>>  2-1
>>>   2-2 2- 2
>>> "snp003""C" "A"   11.03
>>>  2
>>> 0  1
>>> "snp004""G" "A" 2-1.02   

Re: [R] Combining Differnt columns in one single column

2022-06-13 Thread anteneh asmare
Dear Tim it works, But i want to treat them as a column name. Is it
possible to treat as a column name ?

Best,
Hana
On 6/13/22, Ebert,Timothy Aaron  wrote:
> ID5 <- as.data.frame(ID_names1)
> colnames(ID5)<-"val" #rename the columns so they have the same name.
> ID6 <- as.data.frame(ID_names2)
> colnames(ID6)<-"val"
> rbind(ID5, ID6)
>
> This works for the first two, just keep doing the same thing for the
> others.
> Tim
>
> -Original Message-
> From: R-help  On Behalf Of anteneh asmare
> Sent: Monday, June 13, 2022 3:48 PM
> To: r-help@r-project.org
> Subject: [R] Combining Differnt columns in one single column
>
> [External Email]
>
> Dear All, I have the following column name in different data frame and
> different size
> ID_names1 <- paste0("id",1:9)
> ID_names2 <- paste0("id000",10:99)
> ID_names3 <- paste0("id00",100:999)
> ID_names4 <- paste0("id0",1000:)
> ID_names5 <- paste0("id",1:5)
> Dose it possible to combine in to a single column in r?
> Best,
> Hana
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIzwI-q7Xu_&s=xrZArAFWnJf7ja13EEgxwBj-pMBEXBYSQgc6BhtNPAA&e=
> PLEASE do read the posting guide
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIzwI-q7Xu_&s=oUlYLeH_EF5rwea10resAheSjjvJ6nhUl8wT84OVXZM&e=
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Combining Differnt columns in one single column

2022-06-13 Thread Rui Barradas

Hello,

Are you looking for this?


ID_names <- sprintf("id%05d", 1:5)
head(ID_names)
#> [1] "id1" "id2" "id3" "id4" "id5" "id6"
tail(ID_names)
#> [1] "id49995" "id49996" "id49997" "id49998" "id4" "id5"


sprintf with the format %05d pads the integers with zeros to length 5.
And you won't need to combine the 5 vectors, it already is only one.

Hope this helps,

Rui Barradas

Às 20:48 de 13/06/2022, anteneh asmare escreveu:

Dear All, I have the following column name in different data frame and
different size
ID_names1 <- paste0("id",1:9)
ID_names2 <- paste0("id000",10:99)
ID_names3 <- paste0("id00",100:999)
ID_names4 <- paste0("id0",1000:)
ID_names5 <- paste0("id",1:5)
Dose it possible to combine in to a single column in r?
Best,
Hana

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Combining Differnt columns in one single column

2022-06-13 Thread Ebert,Timothy Aaron
Yes, It just takes another step. Here is the new pattern:
ID_names1 <- paste0("id",1:9)
ID_names2 <- paste0("id000",10:99)
ID5 <-as.data.frame(ID_names1) #convert to a dataframe.
ID5$name<-colnames(ID5) #make a new variable from column name.
colnames(ID5)<-c("name","val") #rename columns to be consistent for all 
dataframes.
ID6 <-as.data.frame(ID_names2)
ID6$name<-colnames(ID6)
colnames(ID6)<-c("name","val")
IDall<-rbind(ID5,ID6) 


Tim

-Original Message-
From: anteneh asmare  
Sent: Monday, June 13, 2022 4:49 PM
To: Ebert,Timothy Aaron 
Cc: r-help@r-project.org
Subject: Re: [R] Combining Differnt columns in one single column

[External Email]

Dear Tim it works, But i want to treat them as a column name. Is it possible to 
treat as a column name ?

Best,
Hana
On 6/13/22, Ebert,Timothy Aaron  wrote:
> ID5 <- as.data.frame(ID_names1)
> colnames(ID5)<-"val" #rename the columns so they have the same name.
> ID6 <- as.data.frame(ID_names2)
> colnames(ID6)<-"val"
> rbind(ID5, ID6)
>
> This works for the first two, just keep doing the same thing for the 
> others.
> Tim
>
> -Original Message-
> From: R-help  On Behalf Of anteneh 
> asmare
> Sent: Monday, June 13, 2022 3:48 PM
> To: r-help@r-project.org
> Subject: [R] Combining Differnt columns in one single column
>
> [External Email]
>
> Dear All, I have the following column name in different data frame and 
> different size
> ID_names1 <- paste0("id",1:9)
> ID_names2 <- paste0("id000",10:99)
> ID_names3 <- paste0("id00",100:999)
> ID_names4 <- paste0("id0",1000:)
> ID_names5 <- paste0("id",1:5)
> Dose it possible to combine in to a single column in r?
> Best,
> Hana
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mail
> man_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAs
> Rzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIzw
> I-q7Xu_&s=xrZArAFWnJf7ja13EEgxwBj-pMBEXBYSQgc6BhtNPAA&e=
> PLEASE do read the posting guide
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or
> g_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeA
> sRzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIz
> wI-q7Xu_&s=oUlYLeH_EF5rwea10resAheSjjvJ6nhUl8wT84OVXZM&e=
> and provide commented, minimal, self-contained, reproducible code.
>
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Combining Differnt columns in one single column

2022-06-13 Thread Ebert,Timothy Aaron
Sorry, the last post had a small mistake. I got name and val switched. Here 
they are in the correct order.

ID_names1 <- paste0("id",1:9)
ID_names2 <- paste0("id000",10:99)
ID5 <-as.data.frame(ID_names1)
ID5$name<-colnames(ID5)
colnames(ID5)<-c("val","name")
ID6 <-as.data.frame(ID_names2)
ID6$name<-colnames(ID6)
colnames(ID6)<-c("val","name")
IDall<-rbind(ID5,ID6)


Tim
-Original Message-
From: anteneh asmare  
Sent: Monday, June 13, 2022 4:49 PM
To: Ebert,Timothy Aaron 
Cc: r-help@r-project.org
Subject: Re: [R] Combining Differnt columns in one single column

[External Email]

Dear Tim it works, But i want to treat them as a column name. Is it possible to 
treat as a column name ?

Best,
Hana
On 6/13/22, Ebert,Timothy Aaron  wrote:
> ID5 <- as.data.frame(ID_names1)
> colnames(ID5)<-"val" #rename the columns so they have the same name.
> ID6 <- as.data.frame(ID_names2)
> colnames(ID6)<-"val"
> rbind(ID5, ID6)
>
> This works for the first two, just keep doing the same thing for the 
> others.
> Tim
>
> -Original Message-
> From: R-help  On Behalf Of anteneh 
> asmare
> Sent: Monday, June 13, 2022 3:48 PM
> To: r-help@r-project.org
> Subject: [R] Combining Differnt columns in one single column
>
> [External Email]
>
> Dear All, I have the following column name in different data frame and 
> different size
> ID_names1 <- paste0("id",1:9)
> ID_names2 <- paste0("id000",10:99)
> ID_names3 <- paste0("id00",100:999)
> ID_names4 <- paste0("id0",1000:)
> ID_names5 <- paste0("id",1:5)
> Dose it possible to combine in to a single column in r?
> Best,
> Hana
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mail
> man_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAs
> Rzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIzw
> I-q7Xu_&s=xrZArAFWnJf7ja13EEgxwBj-pMBEXBYSQgc6BhtNPAA&e=
> PLEASE do read the posting guide
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or
> g_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeA
> sRzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIz
> wI-q7Xu_&s=oUlYLeH_EF5rwea10resAheSjjvJ6nhUl8wT84OVXZM&e=
> and provide commented, minimal, self-contained, reproducible code.
>
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Why does qt() return Inf with certain negative ncp values?

2022-06-13 Thread Stephen Berman
Can anyone explain why Inf appears in the following results?

> sapply(-1:-10, \(ncp) qt(1-1*(10^(-4+ncp)), 35, ncp))
 [1]  3.6527153  3.0627759  2.4158355  1.7380812  1.0506904  0.3700821
 [7]Inf -0.9279783 -1.5341759 -2.1085213

> sapply(seq(-6.9, -7.9, -0.1), \(ncp) qt(1-1*(10^(-4+ncp)), 35, ncp))
 [1] -0.2268386InfInfInf -0.4857400 -0.5497784
 [7] -0.6135402 -0.6770143 -0.7401974 -0.8030853 -0.8656810

In case it matters:

> sessionInfo()
R Under development (unstable) (2022-06-05 r82452)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux From Scratch r11.0-165

Matrix products: default
BLAS:   /usr/lib/R/lib/libRblas.so
LAPACK: /usr/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.3.0 tools_4.3.0

Thanks.
Steve Berman

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.