-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
colsn
not found in .data
.
#26
Comments
I guess you have your answer already, so just in case …
The line “adsl2$colsn<-adsl2[[paste0(vars,"N")]]” assigns values from a non existing column named paste0(vars,"N”) to a new column with the name “colsn”. This assignment won’t create the new column.
I hope this is what you were looking for.
Peter
From: venkatamaguluri ***@***.***>
Sent: Tuesday, August 1, 2023 11:24 AM
To: phuse-org/phuse-scripts ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [phuse-org/phuse-scripts] `colsn` not found in `.data`. (Issue #26)
charvar <-function(vars){
adsl2$cols<-adsl2[[vars]]
adsl2$colsn<-adsl2[[paste0(vars,"N")]]
dummy<-adsl2 %>% distinct(., cols, colsn) %>% rename(Name = cols, sortvar = colsn) %>% data.frame()
p=xtabs(~cols+TRT01P,data = adsl2)
dat<-data.frame(Name=rownames(p),rbind(p),row.names = NULL) %>%
mutate_if(is.numeric,function(x) paste0(x, " (",round(x*100/sum(x),2),"%)")) %>%
murtate(category=vars,Name=as.character(Name)) %>%
left_join(dummy,by="Name")
}
what is the problem in my code. it's not showing cols n colsn in data
—
Reply to this email directly, view it on GitHub <#26> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABR4XYLZAA5O66JOROQ4O3DXTENPLANCNFSM6AAAAAA2757JSU> .
You are receiving this because you are subscribed to this thread. <https://github.com/notifications/beacon/ABR4XYKA3N4BNXRZEO45UL3XTENPLA5CNFSM6AAAAAA2757JSWWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHG2KWTB4.gif> Message ID: ***@***.*** ***@***.***> >
|
BTW, I don’t like how you treat the data frame adsl2 as a ‘global’ variable. In my code, I try to avoid this, because I believe that the chance for unintended side effects is way to high.
Just a remark …
Peter
From: venkatamaguluri ***@***.***>
Sent: Tuesday, August 1, 2023 11:24 AM
To: phuse-org/phuse-scripts ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [phuse-org/phuse-scripts] `colsn` not found in `.data`. (Issue #26)
charvar <-function(vars){
adsl2$cols<-adsl2[[vars]]
adsl2$colsn<-adsl2[[paste0(vars,"N")]]
dummy<-adsl2 %>% distinct(., cols, colsn) %>% rename(Name = cols, sortvar = colsn) %>% data.frame()
p=xtabs(~cols+TRT01P,data = adsl2)
dat<-data.frame(Name=rownames(p),rbind(p),row.names = NULL) %>%
mutate_if(is.numeric,function(x) paste0(x, " (",round(x*100/sum(x),2),"%)")) %>%
murtate(category=vars,Name=as.character(Name)) %>%
left_join(dummy,by="Name")
}
what is the problem in my code. it's not showing cols n colsn in data
—
Reply to this email directly, view it on GitHub <#26> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABR4XYLZAA5O66JOROQ4O3DXTENPLANCNFSM6AAAAAA2757JSU> .
You are receiving this because you are subscribed to this thread. <https://github.com/notifications/beacon/ABR4XYKA3N4BNXRZEO45UL3XTENPLA5CNFSM6AAAAAA2757JSWWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHG2KWTB4.gif> Message ID: ***@***.*** ***@***.***> >
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
charvar <-function(vars){
adsl2$cols<-adsl2[[vars]]
adsl2$colsn<-adsl2[[paste0(vars,"N")]]
dummy<-adsl2 %>% distinct(., cols, colsn) %>% rename(Name = cols, sortvar = colsn) %>% data.frame()
p=xtabs(~cols+TRT01P,data = adsl2)
dat<-data.frame(Name=rownames(p),rbind(p),row.names = NULL) %>%
mutate_if(is.numeric,function(x) paste0(x, " (",round(x*100/sum(x),2),"%)")) %>%
murtate(category=vars,Name=as.character(Name)) %>%
left_join(dummy,by="Name")
}
what is the problem in my code. it's not showing cols n colsn in data
The text was updated successfully, but these errors were encountered: