Re: [R] Subtracting Data Frame With a Different Number of Rows

2020-04-21 Thread William Michels via R-help
Hi Phillip, You have two choices here: 1. Manually enter the missing rows into your individual.df using rbind(), and cbind() the overall.df and individual.df dataframes together (assuming the rows line up properly), or 2. Use merge() to perform an SQL-like "Left Join", and copy values from the

Re: [R] NA command in a 'for' loop

2020-04-21 Thread Helen Sawaya
Thank you all. Your suggestions worked. As you said, the problem appeared to have been the commas that were part of the data frame. Thanks again  From: Rui Barradas Sent: Tuesday, April 21, 2020 9:38 PM To: Helen Sawaya Cc: Jim Lemon ; Michael Dewey ;

Re: [R] NA command in a 'for' loop

2020-04-21 Thread Jim Lemon
Hi Helen, >From you last post, I think the best strategy is to make sure that the operations you are performing are giving you the results you want. If so, then we can tackle the multiple input files. As I don't have the library you are using, I cannot access the function "get_tbls", so please

[R] Subtracting Data Frame With a Different Number of Rows

2020-04-21 Thread Phillip Heinrich
I have two small data frames of baseball data. The first one is the mean number of runs that will score in each half inning for the 2018 Arizona Diamondbacks. The second data frame is the same information but for only one player. As you will see the individual player did not come up to bat

Re: [R] NA command in a 'for' loop

2020-04-21 Thread Rui Barradas
Hello, Much better, you have "," at the end of your data elements so nothing is working. The following 3 instructions 1. remove those commas, 2. create a logical vector trying to guess which columns are numeric 3. coerce those columns to numeric. d[] <- lapply(d, function(x){sub(",$", "",

Re: [R] NA command in a 'for' loop

2020-04-21 Thread William Dunlap via R-help
Read the files with read.csv(filename) or read.table(sep=",", filename) so the commas don't become part of the R data.frame. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Apr 21, 2020 at 10:17 AM Helen Sawaya wrote: > Thank you for your patience. > > This is the output of dput(head(d,

Re: [R] Can I use R for comertial projects for free?

2020-04-21 Thread Jeff Newmiller
The "contamination" of other code by GPL is not absolute... it _is_ possible to use GPL code without releasing your code similarly, and blithely suggesting otherwise perpetuates myths about GPL. That said, it is very tricky to do so while presenting a clean user experience, and doing so is

Re: [R] NA command in a 'for' loop

2020-04-21 Thread Helen Sawaya
Thank you for your patience. This is the output of dput(head(d, 10)) structure(list(V1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "9.9761E+11,", class = "factor"), V2 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "threat,", class = "factor"), V3 =

Re: [R] ggplot2 error bars and convex hulls

2020-04-21 Thread Rui Barradas
Hello, As for convex hulls, there is an example of how to construct a stat_hull in vignette("extending-ggplot2", package = "ggplot2") There is also a geom_hull in a GitHub package: devtools::install_github("cmartin/ggConvexHull") Hope this helps, Rui Barradas Às 17:02 de 21/04/20, Ivan

Re: [R] Can I use R for comertial projects for free?

2020-04-21 Thread Jeff Newmiller
If you comply with the relevant licenses... sure... open source can be compatible with commercial activity. But your description of your use case is way too deficient for anyone to even comment on. Since this is not a legal advice forum, go ask your question of a lawyer familiar with open

Re: [R] Can I use R for comertial projects for free?

2020-04-21 Thread Duncan Murdoch
On 21/04/2020 11:11 a.m., dmitry sergey wrote: Hi, I kindly interesting can i use R for commercial projects for free? I am going to get statistics in my commercial project with R and wanted to know will it be legal or no? If you are distributing R as part of your project, then you will need

[R] ggplot2 error bars and convex hulls

2020-04-21 Thread Ivan Calandra
Dear useRs, I would like to have horizontal and vertical error bars extending from the means on two continuous variables. This would be the "manual" way of doing it, computing the mean and sd (or whatever stats) beforehand and then calling geom_errorbar() and geom_errorbarh() with appropriate

[R] Can I use R for comertial projects for free?

2020-04-21 Thread dmitry sergey
Hi, I kindly interesting can i use R for commercial projects for free? I am going to get statistics in my commercial project with R and wanted to know will it be legal or no? Thanks in advance. Best Regards, Dmitry [[alternative HTML version deleted]]

Re: [R] how to merge two files while preserving the number of rows of one file in merged one?

2020-04-21 Thread Jeff Newmiller
Read about the all.x and all.y arguments to ?merge. On April 21, 2020 7:53:33 AM PDT, Ana Marija wrote: >Hello, > >> head(a) > ID_1 pheno >1 0 B >2 fam1000_G1000 0 >3 fam1001_G1001 0 >4 fam1003_G1003 1 >5 fam1005_G1005 0 >6 fam1009_G1009 0 >>

Re: [R] how to merge two files while preserving the number of rows of one file in merged one?

2020-04-21 Thread Ana Marija
this solved it: m=merge(a,b,by="ID_1",all.y = T) On Tue, Apr 21, 2020 at 9:53 AM Ana Marija wrote: > > Hello, > > > head(a) >ID_1 pheno > 1 0 B > 2 fam1000_G1000 0 > 3 fam1001_G1001 0 > 4 fam1003_G1003 1 > 5 fam1005_G1005 0 > 6 fam1009_G1009 0 >

[R] how to merge two files while preserving the number of rows of one file in merged one?

2020-04-21 Thread Ana Marija
Hello, > head(a) ID_1 pheno 1 0 B 2 fam1000_G1000 0 3 fam1001_G1001 0 4 fam1003_G1003 1 5 fam1005_G1005 0 6 fam1009_G1009 0 > head(b) ID_1 ID_2 missing 1 0 0 0 2 fam1000_G1000 fam1000_G1000 0 3

Re: [R] Survival analysis

2020-04-21 Thread Göran Broström
Dear dr Medic, Den 2020-04-17 kl. 23:03, skrev Medic: On 2020-04-17 20:06, Medic wrote: I can't understand how to do a survival analysis (?Surv ()) when some event occurred before the start of observation (left censored). If I understand correctly, there are two methods. I chose a method with:

Re: [R] Web-scraping newbie - dynamic table into R?

2020-04-21 Thread Ivan Krylov
On Sun, 19 Apr 2020 at 22:34, Julio Farach wrote: > But, I'm seeking the last 10 draws shown on the "Winning Numbers," or > 4th tab. The "Network" tab in browser developer tools (usually accessible by pressing F12) demonstrates that the "Winning Numbers" are fetched in JSON format by means of

Re: [R] Web-scraping newbie - dynamic table into R?

2020-04-21 Thread John Kane
Hi Julio, I am just working on my first cup of tea of the morning so I am not functioning all that well but I finally noticed that we have dropped the R-help list. I have put it back as a recipient as there are a lot of people that know about 99%+ more than I do about the topic. I'll keep

Re: [R] Help to download data from multiple URLs with API key

2020-04-21 Thread Eric Berger
Hi Bhaskar, Why not just create a function that does the repetitive work, such as doOne <- function( suffix ) { base_url <- "abcd" # This remains constant b <- "api_key"# the api key - this remains constant c <- paste("series_id=",suffix,sep="") full_url =

[R] Help to download data from multiple URLs with API key

2020-04-21 Thread Bhaskar Mitra
Hello Everyone, I am trying to download data from multiple websites using API key. The code to download from one URL is given below. I have a list of multiple URLs' where the suffix URL 'c' keeps changing. I would appreciate any help on how i can modify the code below that will allow me to

Re: [R] NA command in a 'for' loop

2020-04-21 Thread Rui Barradas
Hello, Thanks for the data. But since the replacements still do not work, please post the output of dput(head(d, 10)) in order for us to have an *exact* copy of the data structure. I had asked for 20 or 30 rows but given your post 10 are enough. With a way to exactly reproduce what you