[R] Create a function problem

2021-05-14 Thread Kai Yang via R-help
Hello List, I was trying to write a function. But I got a error message. Can someone help me how to fix it? Many thanks,Kai > k_subset <- function(p, a, b, c){ +   p  <- select(raw +                ,Pedigree.name +                ,UPN +                ,a +                ,b +                ,c +  

Re: [R] Create a function problem

2021-05-14 Thread Kai Yang via R-help
how to fix the error Thank you,Kai On Friday, May 14, 2021, 05:38:18 PM PDT, Rolf Turner wrote: On Fri, 14 May 2021 17:42:12 +0000 (UTC) Kai Yang via R-help wrote: > Hello List, I was trying to write a function. But I got a error > message. Can someone help me how to fix it?

[R] help to correct the function problem

2021-05-24 Thread Kai Yang via R-help
Hello list,I want to translate some of the R code into function, but I got error message. I'm new for R. please point out where is my problem.thank you,Kai the original working code:p1 <- select(raw             ,Pedigree.name             ,UPN              ,Test.Result.tr_Test.Result1             

[R] replace NA into - for specific column

2021-06-01 Thread Kai Yang via R-help
Hi List, I have a column MMR in a data frame proband_crc2. The column contents missing value and + (means positive).  I need to replace all missing value into - (means negative) I did try with difference ways.  Below are my testing, but not any one works. Can someone help me? Thanks, Kai

Re: [R] if statement and for loop question

2021-05-31 Thread Kai Yang via R-help
estdf$c<-ifelse(testdf$a %in% match_strings,testdf$c,"") testdf$d<-ifelse(testdf$a %in% match_strings,testdf$d,"") testdf I have assumed that you mean "zero length strings" rather than "zeros". Also note that your initial code was producing logical values

Re: [R] replace NA into - for specific column

2021-06-02 Thread Kai Yang via R-help
Hello Jim,Your example works well.Thank you for your help,Kai On Tuesday, June 1, 2021, 04:59:09 PM PDT, Kai Yang via R-help wrote: Hi List, I have a column MMR in a data frame proband_crc2. The column contents missing value and + (means positive).  I need to replace all missing value

Re: [R] R grep question

2021-05-27 Thread Kai Yang via R-help
021, 01:37:58 AM PDT, Rui Barradas wrote: Hello, ifelse needs a logical condition, not the value. Try grepl. CRC$MMR.gene <- ifelse(grepl("MLH1"|"MSH2",CRC$gene.all), "Yes", "No") Hope this helps, Rui Barradas Às 05:29 de 27/05/21, Kai Ya

[R] if statement and for loop question

2021-05-30 Thread Kai Yang via R-help
Hello List,I have a data frame which having the character columns: | a1 | b1 | c1 | d1 | | a2 | b2 | c2 | d2 | | a3 | b3 | c3 | d3 | | a4 | b4 | c4 | d4 | | a5 | b5 | c5 | d5 | I need to do: if a1 not = "Positive" and not = "VUS" then values of  b1, c1 and d1 will be zero out. And do the same

Re: [R] trim NA from concatenate result

2021-06-02 Thread Kai Yang via R-help
Hi Rui, I use the code to fix my problem: try$newcol <- gsub(" NA", "", try$newcol) But, I'll try your solution later. Thank you for your help. Kai On Wednesday, June 2, 2021, 02:08:18 PM PDT, Kai Yang via R-help wrote: Hi List, I use paste function to concatena

[R] R grep question

2021-05-26 Thread Kai Yang via R-help
Hi List, I wrote the code to create a new variable: CRC$MMR.gene<-ifelse(grep("MLH1"|"MSH2",CRC$gene.all,value=T),"Yes","No")   I need to create MMR.gene column in CRC data frame, ifgene.all column contenes MLH1 or MSH2, then the MMR.gene=Yes, if not,MMR.gene=No But, the code doesn't work for

[R] trim NA from concatenate result

2021-06-02 Thread Kai Yang via R-help
Hi List, I use paste function to concatenate  3 character columns together. when I run table to see that, I found 3 categories. How can I write script to trim NA in 2nd and 3rd group and set the first one as NA? Thanks, Kai NA NA NA  NA NA Adenocarcinoma NA Other NA [[alternative HTML

[R] problem for strsplit function

2021-07-07 Thread Kai Yang via R-help
Hello List, I have a  one column data frame to store file name with extension. I want to create new column to keep file name only without extension. I tried to use strsplit("name1.csv", "\\.")[[1]] to do that, but it just retain the first row only and it is a vector.  how can do this for all of

Re: [R] problem for strsplit function

2021-07-08 Thread Kai Yang via R-help
Hello all, I have to learning R from beginning, since my group will get rid of SAS. So, my question may not be very clear for professional R user. I always dealing with column in data frame, not data vector.  Many thanks to Greg's example. it is very helpful. one more question, how can I know

[R] R function question

2021-07-02 Thread Kai Yang via R-help
Hello List,I need to generate summary report for many tables (>200 tables). For each table, I can use the script to generate repost: res <- dbGetQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2")view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try/summarytools.BIODBX.MECCUNIQUE2.html")rm(res)

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
;GEMD.MISSING_DI  One more question,  in the code of "view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try/summarytools.Tabname.html")", can Tabname part be replacted automatic also?  Thank you, KaiOn Friday, July 2, 2021, 12:06:12 PM PDT, Eric Berger wrote: Modify t

[R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hello List, The previous post look massy. I repost my question. Sorry, I need to generate summary report for many tables (>200 tables). For each table, I can use the script to generate report: res <- dbGetQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2") view(dfSummary(res), file =

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
quot;, "GEMD.GEMD_LOT_DEFINITIONS", "GEMD.GEMD_SAMPLES", "GEMD.GEMD_STUDIES", "GEMD.MECCUNIQUE", "GEMD.MECCUNIQUE2", "GEMD.MISSING_DI  One more question,  in the code of "view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try

[R] error message from read.csv in loop

2021-07-09 Thread Kai Yang via R-help
Hello List, I use for loop to read csv difference file into data frame rr.  The data frame rr will be deleted after a comparison and go to the next csv file.  Below is my code: for (j in 1:nrow(ora)) {   mycol  <- ora[j,"fname"]   mycsv  <- paste0(mycol,".csv'")   rdcsv  <-

Re: [R] error message from read.csv in loop

2021-07-09 Thread Kai Yang via R-help
te0(mycol,".csv")         rdcsv  <- noquote(paste0("w:/project/_Joe.B/Oracle/data/", mycsv))         rr[[j]]     <- read.csv(rdcsv) } RegardsMigdonio G. On Fri, Jul 9, 2021 at 1:10 PM Kai Yang via R-help wrote: Hello List, I use for loop to read csv difference file into data fr

Re: [R] problem for strsplit function

2021-07-09 Thread Kai Yang via R-help
Thanks Bert, I'm reading some books now. But it takes me a while to get familiar R. Best, KaiOn Friday, July 9, 2021, 03:06:11 PM PDT, Duncan Murdoch wrote: On 09/07/2021 5:51 p.m., Jeff Newmiller wrote: > "Strictly speaking", Greg is correct, Bert. > >

[R] get data frame using DBI package

2021-07-01 Thread Kai Yang via R-help
Hi List,I use odbc to connect a MSSQL server. When I run the script of "res <- dbSendQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2")", the res is "Formal class OdbcResult". Can someone help me to modify the code to get a data frame?Thanks,Kai [[alternative HTML version deleted]]

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Kai Yang via R-help
to:fra...@tcd.ie <mailto:fra...@tcd.ie> mailto:fra...@gmail.com <mailto:fra...@gmail.com> On Thu, 26 Aug 2021 at 20:04, Kai Yang via R-help mailto:r-help@r-project.org> > wrote: Hi all, I found something, but I don't know why it happen. when I submitted the following code, the E

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Kai Yang via R-help
it expects that argument to be a data frame or something it can change into a data.frame. What you gave it probably is an object meant to represent an EXCEL file or something. You may need to extract a data.frame (or tibble or ...) from it before passing that to ggplot. Avi -Original Message----- Fr

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Kai Yang via R-help
it before passing that to ggplot. Avi -Original Message- From: R-help On Behalf Of Kai Yang via R-help Sent: Thursday, August 26, 2021 11:53 AM To: R-help Mailing List Subject: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 obje

[R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Kai Yang via R-help
Hello List, I got an error message when I submit the code below ggplot(eth, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=ethnicity)) +  geom_rect() +  coord_polar(theta="y")  +  xlim(c(2, 4)   )  Error: `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Kai Yang via R-help
data is to use the dput() function. See ?dput.  If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with. On Thu, 12 Aug 2021 at 11:45, Kai Yang via R-help wrote: > > Hello List, > I use the following code to generat

Re: [R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-13 Thread Kai Yang via R-help
Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Aug 13, 2021 at 2:48 PM Kai Yang via R-help wrote: > >  Hello John, > I put my testing data below. I'm not sure how to use dupt() function. would > you please give me an example? > Thanks, >

[R] data manipulation question

2021-08-23 Thread Kai Yang via R-help
Hello List, I wrote the script below to assign value to a new field DisclosureStatus. my goal is if gl_resultsdisclosed=1 then DisclosureStatus=DISCLOSED else if gl_resultsdisclosed=0 then DisclosureStatus= ATTEMPTED else if gl_resultsdisclosed is missing and gl_discloseattempt1 is not missing

[R] how to find "first" or "last" record after sort in R

2021-09-09 Thread Kai Yang via R-help
Hello List, Please look at the sample data frame below: ID         date1              date2             date3 1    2015-10-08    2015-12-17    2015-07-23 2    2016-01-16    NA                 2015-10-08 3    2016-08-01    NA                 2017-01-10 3    2017-01-10    NA                 

Re: [R] how to find "first" or "last" record after sort in R

2021-09-10 Thread Kai Yang via R-help
Thanks Therneau, duplicated() function works well. --- Kai On Friday, September 10, 2021, 05:13:47 AM PDT, Therneau, Terry M., Ph.D. wrote: I prefer the duplicated() function, since the final code will be clear to a future reader.   (Particularly when I am that future reader). last

[R] ggplot question

2021-09-15 Thread Kai Yang via R-help
Hello List, I use ggplot to draw a stack bar chart. but I error message. please look it below: > ggplot(s8_plot, aes(fill=GTresult, y=cases, x=gc_label) + + geom_bar(position="stack", stat="identity")) Error: Mapping should be created with `aes()` or `aes_()`. GTresult and gc_label are

Re: [R] ODP: ggplot question

2021-09-15 Thread Kai Yang via R-help
ill=GTresult, y=cases, x=gc_label)) + +  geom_bar(position="stack", stat="identity")) Best, Grzegorz Od: Kai Yang via R-help Wysłano: środa, 15 września 2021 19:50 Do: R-help Mailing List Temat: [R] ggplot question Hello List, I use ggplot to draw a stack bar chart. but

Re: [R] ODP: ggplot question

2021-09-16 Thread Kai Yang via R-help
; ggplot(s8_plot, aes(fill=GTresult, y=cases, x=gc_label)) + > > +  geom_bar(position="stack", stat="identity")) > > Best, > > Grzegorz > > Od: Kai Yang via R-help > Wysłano: środa, 15 września 2021 19:50 > Do: R-help Mailing List > Temat: [R] ggplot

[R] order stacked bar plot from total frequency

2021-09-16 Thread Kai Yang via R-help
Hello List, I can order the general bar chart based on frequency, using ggplot2 with the code : aes((reorder(Var1, Freq)), Freq))  I don't know how to order stacked bar plot by total frequency Can you give me some of example? Thank you Kai [[alternative HTML version deleted]]

[R] dbWriteTable does not append rows in database

2021-09-13 Thread Kai Yang via R-help
Hi List, I want to append some rows from R into sql server. So, I submitted the code below. there is not any error message: dbWriteTable(conn = con, name = "PMDB._Alias_A", value = try1, overwrite=FALSE, append=TRUE, row.names = FALSE) But when I try to query the data from the Sql server, I can

Re: [R] assign a data frame name from a list in do loop

2021-07-14 Thread Kai Yang via R-help
e loop: sdif[[j]] <- sqldf(etc) Also, once again, why noquote? It's better to form file names with file.path: rdcsv  <- file.path("w:/project/_Joe.B/Oracle/data", mycsv) Hope this helps, Rui Barradas Às 16:55 de 14/07/2021, Kai Yang via R-help escreveu: > Hello List, >

[R] assign a data frame name from a list in do loop

2021-07-14 Thread Kai Yang via R-help
Hello List, I wrote a script below to compare the difference of data frames structure (and will do something else). First of all I save the file list in a data frame ora, then I use for loop to 1. load the data from two resource, 2. generate data structure into two data frames, 3.do the

[R] ls() pattern question

2021-07-14 Thread Kai Yang via R-help
Hello List, I have many data frames in environment.  I need to keep 3 data frames only, con DB2 and ora.  I write the script to do this.  rm(ls(pattern != c("(con|DB2|ora)"))) but it give me an error message: Error in rm(ls(pattern != c("(con|DB2|ora)"))) :    ... must contain names or

Re: [R] ls() pattern question

2021-07-14 Thread Kai Yang via R-help
uot;, and "ora", I would try something like setdiff(ls(), c("con", "DB2", "ora")) and then add `rm` to that like rm(list = setdiff(ls(), c("con", "DB2", "ora"))) On Wed, Jul 14, 2021 at 7:41 PM Kai Yang via R-help wrote: &

[R] ggplot: add percentage for each element in legend and remove tick mark

2021-08-12 Thread Kai Yang via R-help
Hello List, I use the following code to generate a donut plot. # Compute percentages eth$fraction = eth$individuals / sum(eth$individuals) # Compute the cumulative percentages (top of each rectangle) eth$ymax = cumsum(eth$fraction) # Compute the bottom of each rectangle eth$ymin = c(0,

[R] ggplot2 bar chart: order display for each group

2021-09-20 Thread Kai Yang via R-help
Hello List, I submitted the code below, it will show two groups of avg_time bar chart for each gc_label. ggplot(s8_GCtime, aes(fill=GTresult, y=avg_time, x=gc_label, label = avg_time)) +    geom_bar(position=position_dodge(), stat="identity") +   geom_text(aes(label=avg_time), vjust=1.6,

[R] GTsummary add title with multi row

2021-12-06 Thread Kai Yang via R-help
Hi R team,When I use GTsummary to run summary table, I can add table title by using modify_caption() function. But it is one row title only.Is it possible to add title with multi rows for one summary table?Thanks,Kai [[alternative HTML version deleted]]

Re: [R] question about error message: "Aesthetics must be either length 1 or the same as the data (226): y and colour"

2021-12-30 Thread Kai Yang via R-help
rce or perhaps select to pick only the data you want... On 30 Dec 2021 18:42, Kai Yang via R-help wrote: Hi R team, I can create a plot using the code below: library(ggplot2) library(dplyr) mpg %>%   filter(hwy <35) %>%    ggplot(aes(x = displ, y = hwy, color = cyl)) +    geom_point() ggs

[R] question about error message: "Aesthetics must be either length 1 or the same as the data (226): y and colour"

2021-12-30 Thread Kai Yang via R-help
Hi R team, I can create a plot using the code below: library(ggplot2) library(dplyr) mpg %>%   filter(hwy <35) %>%    ggplot(aes(x = displ, y = hwy, color = cyl)) +    geom_point() ggsave("c:/temp/hwy_cyl.jpg",width = 9, height = 6, dpi = 1200, units = "in") I want to do the exactly same work

[R] for loop question in R

2021-12-22 Thread Kai Yang via R-help
Hello R team,I want to use for loop to generate multiple plots with 3 parameter, (y is for y axis, c is for color and f is for file name in output). I created a data frame to save the information and use the information in for loop. I use y[i], c[i] and f[i] in the loop, but it seems doesn't

Re: [R] for loop question in R

2021-12-22 Thread Kai Yang via R-help
lt;- data.frame(y,c,f) for (i in seq(nrow(mac))){   mpg %>%     filter(hwy <35) %>%      ggplot(aes(x = displ, y = y[i], color = c[i])) +      geom_point()   ggsave(paste0("c:/temp/",f[i],".jpg"),width = 9, height = 6, dpi = 1200, units = "in") } On Wednes

Re: [R] for loop question in R

2021-12-22 Thread Kai Yang via R-help
height = 6, dpi = 1200, units = "in") } On Wednesday, December 22, 2021, 09:42:45 AM PST, Ivan Krylov wrote: On Wed, 22 Dec 2021 16:58:18 + (UTC) Kai Yang via R-help wrote: > mpg %>%    filter(hwy <35) %>%     ggplot(aes(x = displ, y = y[i], > color = c[i

[R] question about for loop

2021-12-24 Thread Kai Yang via R-help
Hello Team, I create a csv file (mac2) to save parameter values. the file looks like: y,c,f hwy,cyl,hwy_cyl2 cty,class,cty_class2 Then I load the file into R and apply the parameters y, c, f in for loop, see my code below: library(ggplot2) library(tidyverse) library(readr) mac2 <-

Re: [R] question about for loop

2021-12-24 Thread Kai Yang via R-help
) +             ylab(y) +             guides(                 color = guide_legend(title = c)             )         ggsave(             filename = paste0("C:/temp/", f, ".jpg"),             plot = ggplt,             width = 9, height = 6, dpi = 1200         )     }) } On Fr

Re: [R] question about for loop

2021-12-24 Thread Kai Yang via R-help
            guides(                 color = guide_legend(title = c)             )         ggsave(             filename = paste0("C:/temp/", f, ".jpg"),             plot = ggplt,             width = 9, height = 6, dpi = 1200         )     }) } On Fri, Dec 24, 2021 at

[R] problem: try to passing macro value into submit block

2021-12-21 Thread Kai Yang via R-help
Hi team,I'm trying to pass macro variable into R script in Proc iml. I want to do change variable in color= and export the result with different file name.If I don't use macro, the code work well. But when I try to use macro below, I got error message: "Submit block cannot be directly placed in

Re: [R] for loop question in R

2021-12-22 Thread Kai Yang via R-help
i])) -> p[[i]]   ggsave(     paste0(tmpdir, f[i], ".jpg"),     plot = p[[i]],     width = 9,     height = 6,     dpi = 1200,     units = "in") } # See the first plot p[[1]] Hope this helps, Rui Barradas Às 18:18 de 22/12/21, Kai Yang via R-help escreveu: >  Hello Eric, Jim and I

[R] SOMAscan data analysis

2021-12-02 Thread Kai Yang via R-help
Hello R team,we have a huge SOMAscan data set. This is an aptamer-based protecomics assay capable of measuring 1305 human protein analytes. does anyone know which package can load the data and do analysis? I apricate any suggestion, your experience, web page, paper  Thank you,Kai

[R] subset data frame problem

2021-12-12 Thread Kai Yang via R-help
Hi R team,I want to delete records from a data frame if Class = '1st' and Survived = 'No'. I wrote the code below, test <- subset(PD, Class != '1st' && Survived != 'No') but the code return a wrong result. Can someone help me for this?  Thanks,Kai [[alternative HTML version deleted]]

Re: [R] subset data frame problem

2021-12-13 Thread Kai Yang via R-help
<- PD$Class == "1st" & PD$Survived == "No"test <- PD[!unwanted,] On Mon, 13 Dec 2021 at 17:30, Kai Yang via R-help wrote: Hi R team,I want to delete records from a data frame if Class = '1st' and Survived = 'No'. I wrote the code below, test <- subset(P

[R] how to find the table in R studio

2022-01-12 Thread Kai Yang via R-help
Hi all, I created a function in R. It will be generate a table "temp". I can view it in R studio, but I cannot find it on the top right window in R studio. Can someone tell me how to find it in there? Same thing for f_table.  Thank you, Kai library(tidyverse) f1 <- function(indata , subgrp1){  

[R] function problem: multi selection in one argument

2022-01-24 Thread Kai Yang via R-help
Hello Team, I can run the function below: library(tidyverse) f2 <- function(indata, subgrp1){   indata0 <- indata   temp    <- indata0 %>% select({{subgrp1}}) %>% arrange({{subgrp1}}) %>%      group_by({{subgrp1}}) %>%     mutate(numbering =row_number(), max=max(numbering))   view(temp)  

Re: [R] rename files in R

2022-09-19 Thread Kai Yang via R-help
be character (not factor) columns in your data frame. Cheers,Bert     On Mon, Sep 19, 2022 at 10:38 AM Kai Yang via R-help wrote:  Hi Rui,I put original file names and target file names into data frame: total_name. I can use file.rename("out_1.pdf", "abc_title.pdf") to

Re: [R] rename files in R

2022-09-19 Thread Kai Yang via R-help
he names of the > columns that are in the first row, selecting the first element from > colnames() and setting the file name equal to that. > > Do a for loop using current file names in some folder, and save to a new > folder. > > Tim > > -----Original Message- &g

Re: [R] rename files in R

2022-09-16 Thread Kai Yang via R-help
things will occur including data loss. > > Hope this helps, > > Rui Barradas > > Às 18:26 de 16/09/2022, Kai Yang via R-help escreveu: >> Hello,I have a lot of files with not meaningful name, such as:  file1.txt, >> file2.txt .. I need to rename them using the in

[R] rename files in R

2022-09-16 Thread Kai Yang via R-help
Hello,I have a lot of files with not meaningful name, such as:  file1.txt, file2.txt .. I need to rename them using the information from the first row of the files. Now I can get the information from the first row of each file. Now, I need know how to rename them in R (using loop?). Thank

Re: [R] automatic convert list to dataframe

2022-10-03 Thread Kai Yang via R-help
t;) and then run list2env like above. Hope this helps, Rui Barradas Às 16:51 de 03/10/2022, Kai Yang via R-help escreveu: > Hi R team, > I can use rio package to read excel file into R as a list. The excel file > content multiple sheets (30 - 40 data sheets). I can convert each data

Re: [R] automatic convert list to dataframe

2022-10-03 Thread Kai Yang via R-help
es dx1, dx2, etc, in the global environment. > If you really need the names file1_dx1, file1_dx2, etc, you can first > change the names > > > names(file1) <- paste("file1", names(file1), sep = "_") > > > and then run list2env like above. &

Re: [R] automatic convert list to dataframe

2022-10-03 Thread Kai Yang via R-help
, Could you please help me to >> debug it? >> Thank you,Kai    On Monday, October 3, 2022 at 10:14:25 AM PDT, Rui Barradas >> wrote: >>    >>    Hello, >> >> >> list2env(file1, envir = .GlobalEnv) >> >> >> will create data.f

[R] automatic convert list to dataframe

2022-10-03 Thread Kai Yang via R-help
Hi R team, I can use rio package to read excel file into R as a list. The excel file content multiple sheets (30 - 40 data sheets). I can convert each data elements into dataframe manually. I have multiple excel files with multiple data sheets. I need to load them into R and do the comparison

[R] is it possible to run multiple rmd files together

2023-01-04 Thread Kai Yang via R-help
Hi Team,I have multiple rmd files (~50) for difference study report. I did try the source command to run them together, but it seems doesn't work.Is there a way to run those rmd files from one script?Thanks,Kai [[alternative HTML version deleted]]

Re: [R] add specific fields in for loop

2022-11-15 Thread Kai Yang via R-help
uot;,[" I think I use [i] in a wrong way. Do you have any suggestion? Thanks, Kai On Tuesday, November 15, 2022 at 10:54:08 AM PST, Rui Barradas wrote: Às 16:18 de 15/11/2022, Kai Yang via R-help escreveu: > Hi Team, > I can write a for loop like this: > for (i in column

Re: [R] add specific fields in for loop

2022-11-15 Thread Kai Yang via R-help
e any suggestion? > Thanks, > Kai  On Tuesday, November 15, 2022 at 10:54:08 AM PST, Rui Barradas > wrote: >  >  Às 16:18 de 15/11/2022, Kai Yang via R-help escreveu: >> Hi Team, >> I can write a for loop like this: >> for (i in columns(df)){ >>      ..

Re: [R] add specific fields in for loop

2022-11-15 Thread Kai Yang via R-help
or that are of certain types. Avi -Original Message- From: R-help On Behalf Of Kai Yang via R-help Sent: Tuesday, November 15, 2022 11:18 AM To: R-help Mailing List Subject: [R] add specific fields in for loop Hi Team, I can write a for loop like this: for (i in columns(df)){   .. }

Re: [R] add specific fields in for loop

2022-11-15 Thread Kai Yang via R-help
s fairly simple, such as dplyr where you can ask to match names that start or end a certain way or that are of certain types. Avi -Original Message- From: R-help mailto:r-help-boun...@r-project.org> > On Behalf Of Kai Yang via R-help Sent: Tuesday, November 15, 2022 11:18 AM T

[R] add specific fields in for loop

2022-11-15 Thread Kai Yang via R-help
Hi Team, I can write a for loop like this: for (i in columns(df)){   .. } But it will working on all column in dataframe df. If I want to work on some of specific fields (say: the fields' name content 'date'), how should I modify the for loop? I changed the code below, but it doesn't work.

[R] Problem to run python code in r markdown

2023-01-20 Thread Kai Yang via R-help
Hi Team,I'm trying to run python in R markdown (flexdashboard). The code is below: try Python= ```{r, include=FALSE, echo=TRUE}library(reticulate)py_install("numpy") use_condaenv("base") ``` ```{python}import numpy as np``` I got error message below: Error in py_call_impl(callable,

[R] connect MSSQL server problem

2023-03-17 Thread Kai Yang via R-help
Hi Team,I need to connect two MSSQL servers. One server ask me to enter user name and password. I can use dbConnect (from DBI package) to connect the serve.Another one do not ask me credential to access the serve. But when I remove UID and PWD, it doesn't work. Then I tried to use my PC log in