[R] Data consideration in executing pca

2024-02-25 Thread Jiji Sid
Dear R users, I have a txt file named 'data_1.txt' whose first column contains the names of the individuals and the other columns contain the values of four variables X_1,X_2,X_3 and X_4. I read it with R from its location and called it data. I'd like to do a normalized principal component analys

Re: [R] data frame returned from sapply but vector expected

2022-11-04 Thread PIKAL Petr
2022 1:37 PM > To: PIKAL Petr > Cc: R-help Mailing List > Subject: Re: [R] data frame returned from sapply but vector expected > > On Fri, 4 Nov 2022 15:30:27 +0300 > Ivan Krylov wrote: > > > sapply(mylist2, `[[`, 'b') > > Wait, that would simplify t

Re: [R] data frame returned from sapply but vector expected

2022-11-04 Thread Ivan Krylov
On Fri, 4 Nov 2022 15:30:27 +0300 Ivan Krylov wrote: > sapply(mylist2, `[[`, 'b') Wait, that would simplify the return value into a matrix when there are no NULLs. But lapply(mylist2, `[[`, 'b') should work in both cases, which in my opinion goes to show the dangers of using simplifying function

Re: [R] data frame returned from sapply but vector expected

2022-11-04 Thread Ivan Krylov
On Fri, 4 Nov 2022 12:19:09 + PIKAL Petr wrote: > > str(sapply(mylist2, "[", "b")) > > List of 3 > > $ : NULL > > $ :'data.frame': 5 obs. of 1 variable: > > ..$ b: num [1:5] 0.01733 0.46055 0.19421 0.11609 0.00789 > > $ :'data.frame': 5 obs. of 1 variable: > > ..$ b:

[R] data frame returned from sapply but vector expected

2022-11-04 Thread PIKAL Petr
Hallo all I found a strange problem for coding if part of list is NULL. In this case, sapply result is ***list of data frames*** but if there is no NULL leaf, the result is ***list of vectors***. I tried simplify option but it did not help me neither I found anything in help page. The

Re: [R] data manipulation question

2021-08-23 Thread Jim Lemon
Hi Kai, How about setting: germlinepatients$DisclosureStatus <- NA then having your three conditional statements as indices: germlinepatients$DisclosureStatus[germlinepatients$gl_resultsdisclosed == 1] <-"DISCLOSED" germlinepatients$DisclosureStatus[germlinepatients$ gl_resultsdisclosed == 0] <-

[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 the

Re: [R] Data is not properly written in csv file

2021-06-21 Thread David Winsemius
This was an exact duplicate of a posting to StackOverflow where it has a response. You are asked in the Posting Guide not to crosspost. -- David. On 6/20/21 8:03 AM, Sri Priya wrote: location <- ' http://keic.mica-apps.net/wwwisis/ET_Annual_Reports/Religare_Enterprises_Ltd/RELIGARE-2017-2018

Re: [R] Data is not properly written in csv file

2021-06-21 Thread Marc Schwartz via R-help
Hi, If each of the extracted tables do not have consistent content and structure, that may be causing problems as you append each to the same file. You might want to modify your loop so that each table gets written to a different CSV file and see what that looks like. Also, review ?write.ta

Re: [R] Data is not properly written in csv file

2021-06-21 Thread Bert Gunter
Please read the posting guide, linked below, which says: "For questions about functions in standard packages distributed with R (see the FAQ Add-on packages in R ), ask questions on R-help. If the question relates to a *contribute

Re: [R] Data transformation problem

2020-11-12 Thread phil
Thank you so much for this elegant solution, Jeff. Philip On 2020-11-12 02:20, Jeff Newmiller wrote: I am not a data.table afficiando, but here is how I would do it with dplyr/tidyr: library(dplyr) library(tidyr) do_per_REL <- function( DF ) { rng <- range( DF$REF1 ) # watch out for missing

Re: [R] Data transformation problem

2020-11-11 Thread Jeff Newmiller
I am not a data.table afficiando, but here is how I would do it with dplyr/tidyr: library(dplyr) library(tidyr) do_per_REL <- function( DF ) { rng <- range( DF$REF1 ) # watch out for missing months? DF <- ( data.frame( REF1 = seq( rng[ 1 ], rng[ 2 ], by = "month" ) ) %>% left_join

[R] Data transformation problem

2020-11-11 Thread phil
I am stuck on a data transformation problem. I have a data frame, df1 in my example, with some original "levels" data. The data pertain to some variable, such as GDP, in various reference periods, REF, as estimated and released in various release periods, REL. The release periods follow after t

Re: [R] Data Table not rendering properly using R shiny

2020-11-07 Thread Rui Barradas
Hello, Or maybe logical_idx <- max_usage_hours_per_region$Region %in% input$Region Another option is ?match Hope this helps, Rui Barradas Às 15:41 de 07/11/20, Jeff Newmiller escreveu: This looks odd... max_usage_hours_per_region[input$Region,] This would only work if you had rownames

Re: [R] Data Table not rendering properly using R shiny

2020-11-07 Thread Jeff Newmiller
This looks odd... max_usage_hours_per_region[input$Region,] This would only work if you had rownames on that data frame corresponding to the names of the Regions. This is a common R mistake... you probably need logical_idx <- max_usage_hours_per_region$Region == input$Region max_usage_hours_per

Re: [R] Data Table not rendering properly using R shiny

2020-11-07 Thread Marc Schwartz via R-help
Hi, Please drop R-Devel as a cc: from this thread for further replies. This topic is definitely not relevant there and cross-posting is not needed, but does require manual moderation. Thanks, Marc Schwartz > On Nov 7, 2020, at 10:23 AM, Bert Gunter wrote: > > Better to post on RStudio sup

Re: [R] Data Table not rendering properly using R shiny

2020-11-07 Thread Bert Gunter
Better to post on RStudio support, I think. Shiny is an RStudio package and product and this list if for R language/programming help. The two are separate. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breat

[R] Data Table not rendering properly using R shiny

2020-11-07 Thread Ritwik Mohapatra
Hi All, I have a data output as below.I want to display them in an interactive html report using shiny but the data table is not rendering properly and instead giving NA values. max_usage_hours_per_region<-setNames(aggregate(df3_machine_region$sum_as_hours~df3_machine_region$Region,df3_machine_re

[R] [R-pkgs] xmlconvert: A package for converting XML data to R data frames and vice versa

2020-11-05 Thread joachim
Hello everyone, Driven by the need to work with XML data from medical systems that use object-oriented databases I have developed the 'xmlconvert' package. With its easy-to-use functions xml_to_df() and df_to_xml() it allows to convert data from XML to R data frames and vice versa. A

Re: [R] data error problem

2020-10-05 Thread Jim Lemon
Hi Mir, Without knowing what the data looks like, this is only a guess. read.table() expects a white space delimiter and if you have a space in one of your column names it will consider it as two names instead of one. How many columns do you expect? Jim On Mon, Oct 5, 2020 at 6:14 PM Mohammad Tan

Re: [R] data error problem

2020-10-05 Thread Mohammad Tanvir Ahamed via R-help
Hi, In your data file, the first row does not have an equal number of column like the rest of the row.Check your data file. Specially 1st row.   Regards.Tanvir AhamedStockholm, Sweden | mashra...@yahoo.com On Monday, 5 October 2020, 08:11:48 am GMT+2, Mir Md. Abdus Sal

[R] data error problem

2020-10-04 Thread Mir Md. Abdus Salam
Dear all, I need urgent help. I am a new user of R. I got the following error anovamine<-read.table("spike cu.txt",header=TRUE) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 9 elements Can anybody please help me to solve this problem why I am

Re: [R] Data With Ordinal Responses: Calculate ICC & Assessing Model Fit

2020-08-17 Thread Bert Gunter
I believe you should post on r-sig-mixed-models, not here. You are more likely to find the interest and expertise you seek there. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" c

[R] Data With Ordinal Responses: Calculate ICC & Assessing Model Fit

2020-08-17 Thread Sidoti, Salvatore A.
To begin with, I'm not a fan of cross-posting. However, I posted my question on Stack Exchange more than two weeks ago, but I have yet to receive a sufficient answer: https://stats.stackexchange.com/questions/479600/data-with-ordinal-responses-calculate-icc-assessing-model-fit Here's what I've

Re: [R] Data frames intersections

2020-04-22 Thread Jim Lemon
Hi Julie, Your task is a bit obscure and I don't have the function "st_intersects", but I'll suggest this: br_list<-list() # your commands would have only run once for (i in 1:nrow(arrets_buffer)) { br_list[[i]]<- st_intersects(x = batiments, arrets_buffer[i,], sparse = FALSE) } You should get

[R] Data frames intersections

2020-04-22 Thread Julie Poitevin
Hello, > I want to build a map (bus accessibility map) and for that I need to identify > some polygons intersections. To do that I have 2 data.frame: batiments (that > gives buildings in a city) and arrets_buffer (that gives bus stops (points) > with a buffer around the point). > > I want to h

Re: [R] Data Carpentry - Creating a New SQLite Database

2020-01-10 Thread William Michels via R-help
b (or posting a new issue yourself): https://github.com/datacarpentry/R-ecology-lesson/issues Finally, I really feel you'll benefit from reading over the documents pertaining to "R Data Import/Export" on the www.r-project.org website. No disrespect to the people at 'datacarpentry&#x

Re: [R] Data Carpentry - Creating a New SQLite Database

2020-01-10 Thread Bert Gunter
t; download.file("https://ndownloader.figshare.com/files/3299474";, > "data_raw/plots.csv") > library(tidyverse) > species <- read_csv("data_raw/species.csv")No problem here. I’m pulling > three databases from the Web and saving them to a folde

Re: [R] Data Carpentry - Creating a New SQLite Database

2020-01-10 Thread Ivan Krylov
pped off (and since HTML-enabled mail clients don't quite care how the plain text version of the e-mail looks, some paragraph breaks had to go, too). > etc.surveys <- read_csv("data_raw/surveys.csv") > plots <- read_csv("data_raw/plots.csv") > Again no proble

[R] Data Carpentry - Creating a New SQLite Database

2020-01-10 Thread Phillip Heinrich
s <- read_csv("data_raw/species.csv")No problem here. I’m pulling three databases from the Web and saving them to a folder on my hard drive. (...data_raw/species.csv) etc.surveys <- read_csv("data_raw/surveys.csv") plots <- read_csv("data_raw/plots.csv&qu

Re: [R] data reshape

2019-12-20 Thread Yuan Chun Ding
Cc: r-help@r-project.org Subject: Re: [R] data reshape [Attention: This email came from an external source. Do not open attachments or click on links from unknown senders or unexpected emails.] It is perhaps worth noting that

Re: [R] data reshape

2019-12-20 Thread Bert Gunter
; One my way to work place this morning, I changed my intension; I will not >> reshape to wide format and actually like the long format I generated. I >> will read in a VNTR marker annotation file including VNTRid in first column >> and marker locations in human chromosomes in the sec

Re: [R] data reshape

2019-12-20 Thread Bert Gunter
the 652 file I read in. > > > > Do you know a good way to merge all those 652 files (with two columns) ? > > > > Thank you, > > > > Ding > > > > > > #merge all 652 files into one file with VNTRid as first column, 2nd to > 653th column are genot

Re: [R] data reshape

2019-12-20 Thread Yuan Chun Ding
erge all 652 files into one file with VNTRid as first column, 2nd to 653th column are genotype with header #as sample ID, so From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Thursday, December 19, 2019 6:52 PM To: Yuan Chun Ding Cc: r-help@r-project.org Subject: Re: [R] data reshape __

Re: [R] data reshape

2019-12-19 Thread Bert Gunter
Did you even make an attempt to do this? -- or would you like us do all your work for you? If you made an attempt, show us your code and errors. If not, we usually expect you to try on your own first. If you have no idea where to start, perhaps you need to spend some more time with tutorials to le

[R] data reshape

2019-12-19 Thread Yuan Chun Ding
Hi R users, I have a folder (called genotype) with 652 files; the file names are GTEX-1A3MV.out, GTEX-1A3MX.out, GTEX-1B8SF.out, etc; in each file, only one column of data without a header as below 201 2/2 238 3/4 245 1/2 . 983255 3/3 983766 None A total of 20528 rows; I need to read al

Re: [R] Data Structure to Unnest_tokens in tidytext package

2019-12-11 Thread Eric Berger
Hi Sarah, I looked at the documentation that you linked to. It contains the step text_df <- tibble(line = 1:4, text = text) before it does the step text_df %>% unnest_tokens(word, text) So you may be missing a step. Best, Eric On Tue, Dec 10, 2019 at 9:05 PM Sarah Payne wrote: > > Hi--I'm

[R] Data Structure to Unnest_tokens in tidytext package

2019-12-10 Thread Sarah Payne
Hi--I'm fairly new to R and trying to do a text mining project on a novel using the tidytext package. The novel is saved as a plain text document and I can import it into RStudio just fine. For reference I'm trying to do something similar to section 1.3 of this tidy text tutorial

Re: [R] data load from excel files

2019-11-13 Thread Rui Barradas
Hello, Try which.max? Hope this helps, Rui Barradas Às 14:10 de 13/11/19, ani jaya escreveu: Thank you very much Mr. Rui, but for delete the duplicated row I use: ... library(tidyverse) alldata<-data.frame(Reduce(rbind, pon1)) c<-(which(duplicated(alldata$Tanggal))) #duplicate alldata<-allda

Re: [R] data load from excel files

2019-11-13 Thread ani jaya
Thank you very much Mr. Rui, but for delete the duplicated row I use: ... library(tidyverse) alldata<-data.frame(Reduce(rbind, pon1)) c<-(which(duplicated(alldata$Tanggal))) #duplicate alldata<-alldata[-c,] attach(alldata) because not every last row from every df is bad one. Another problem

Re: [R] data load from excel files

2019-11-13 Thread Rui Barradas
Hello, Maybe the following will get you close to what you want. # remove the last row from every df pon1 <- lapply(pon1, function(DF){ DF[[1]] <- as.Date(DF[["Tanggal"]], "%d-%m-%Y") DF[-nrow(DF), ] }) # order the list by year-month inx_ym <- sapply(pon1, function(DF){ format(DF[["Tangg

[R] data load from excel files

2019-11-12 Thread ani jaya
Dear R-Help, I have 30 of year-based excel files and each file contain month sheets. I have some problem here. My data is daily rainfall but there is extra 1 day (first date of next month) for several sheets. My main goal is to get the minimum value for every month. First, how to extract those da

Re: [R] Data conversion

2019-09-18 Thread Jim Lemon
Hi Edward, Say your "data frame" is named "epdat". This may do it: epmat<-matrix(epdat[10:289],nrow=28) colnames(epmat)<-sub("1","",names(epdat[10:289])[seq(1,270,by=28)]) This one looks like the Sorceror's Apprentice tangled with one of those experimental schedule scripting programs. Jim On Th

[R] Data conversion

2019-09-18 Thread Patzelt, Edward
Hi R Help, How would I convert the data below so that I have it formatted with trials along the rows and then each type of measure separately? e.g., Subject RT OnOff Feedback Trial_1 Trial_2 Trial_3 Trial_4 Thanks! Edward structure(list(TAP_ID = "967372 ", TAP_Date = NA_real_,

Re: [R] Data frame organization

2019-08-27 Thread Arnaud Mosnier
Aaaah finally !!! Thanks a lot !!! Arnaud Le lun. 26 août 2019 18 h 28, Jim Lemon a écrit : > Hi Arnaud, > The reason I wrote the following function is that it always takes me > half a dozen tries with "reshape" before I get the syntax right: > > amdf<-read.table(text="A 10 > B 5 > C

Re: [R] Data frame organization

2019-08-26 Thread Jim Lemon
Hi Arnaud, The reason I wrote the following function is that it always takes me half a dozen tries with "reshape" before I get the syntax right: amdf<-read.table(text="A 10 B 5 C 9 A 5 B 15 C 20") library(prettyR) stretch_df(amdf,"V1","V2") V1 V2_1 V2_2 1 A 105 2 B5 15 3

[R] Data Frame Organization

2019-08-26 Thread Sam Charya via R-help
There is some issue with the plain text vs. HTML - please find the answer again. If illegible kindly see the attached pic. Best Wishes. s. x <- c('A', 'B', 'C', 'A', 'B', 'C') y <- c(10, 5, 9, 5, 15, 20) df <- data.frame(x,y) df f <- reshape(df, v.names = "y", idvar = "x", timevar = "y", directi

Re: [R] Data frame organization

2019-08-26 Thread Sam Charya via R-help
Dear Arnaud, I just played around with your data a bit and found this to be useful. But kindly note that I am NO expert like the other people in the group. My answer to you is purely for help purposes. My knowledge in R too is limited. I used the reshape function and arrived at something. I am 

[R] Data frame organization

2019-08-26 Thread Arnaud Mosnier
Hi, I have a really simple question. I need to convert a data.frame with the following format A 10 B 5 C 9 A 5 B 15 C 20 in this format A 10 5 B 515 C 920 Thanks !!! [[alternative HTML version deleted]] __ R-help

Re: [R] Downloading R Data

2019-04-14 Thread Jim Lemon
Hi Spencer, Just download it to your R working directory and: load("GBM_data.Rdata") Worked okay for me (all 53.9 Mb) Jim On Mon, Apr 15, 2019 at 8:39 AM Spencer Brackett wrote: > > I am also looking to be able to read this file on an appropriate > application. As of now, it’s too large to v

Re: [R] Downloading R Data

2019-04-14 Thread Daniel Nordlund
On 4/14/2019 3:36 PM, Spencer Brackett wrote: I am also looking to be able to read this file on an appropriate application. As of now, it’s too large to view directly in GoogleDrive or word, and I can only get a mistranslated version of the script included as a .txt file. [image: File] GBM_

[R] Downloading R Data

2019-04-14 Thread Spencer Brackett
I am also looking to be able to read this file on an appropriate application. As of now, it’s too large to view directly in GoogleDrive or word, and I can only get a mistranslated version of the script included as a .txt file. [image: File] GBM_Data.RData

Re: [R] data frame solution

2019-03-20 Thread Izmirlian, Grant (NIH/NCI) [E] via R-help
iling List Subject: [R] data frame solution Hello All, wonder if you have thoughts on a clever solution for this code: df <- data.frame(a = c(6,1), b = c(1000,1200), c =c(-1,3)) #the caveat here is that the number of rows for df can be anything from 1 row to in the hundreds. I kept it

[R] data frame solution

2019-03-19 Thread Andras Farkas via R-help
Hello All, wonder if you have thoughts on a clever solution for this code: df       <- data.frame(a = c(6,1), b = c(1000,1200), c =c(-1,3))  #the caveat here is that the number of rows for df can be anything from 1 row to in the hundreds. I kept it to 2 to have minimal reproducible t<-seq(-5

Re: [R] R Data

2019-02-14 Thread Fowler, Mark
I am not sure I would use the word ‘accounted’, more like discounted (tossed out). From: Spencer Brackett Sent: February 14, 2019 9:21 AM To: Fowler, Mark Cc: R-help ; Sarah Goslee ; Caitlin Gibbons ; Jeff Newmiller Subject: Re: R Data Mr. Fowler, Thank you! This information is most

Re: [R] R Data

2019-02-14 Thread Spencer Brackett
] 2 7 2NA > [3,] 3 8 3NA > [4,] 4 9 4NA > [5,] 5 10 5NA > > -Original Message- > From: R-help On Behalf Of Spencer Brackett > Sent: February 14, 2019 12:32 AM > To: R-help ; Sarah Goslee ; > Caitlin Gibbons ; Jeff Newmiller < > jdnew...@dcn.da

Re: [R] R Data

2019-02-14 Thread Fowler, Mark
NA [4,] 4 9 4NA [5,] 5 10 5NA -Original Message- From: R-help On Behalf Of Spencer Brackett Sent: February 14, 2019 12:32 AM To: R-help ; Sarah Goslee ; Caitlin Gibbons ; Jeff Newmiller Subject: [R] R Data Hello everyone, The following is a portion of coding that a coll

[R] R Data

2019-02-13 Thread Spencer Brackett
Hello everyone, The following is a portion of coding that a colleague sent. Given my lack of experience in R, I am not quite sure what the significance of the following arguments. Could anyone help me translate? For context, I am aware of the downloading portion of the script... library(data.table

Re: [R] data transformation

2019-01-20 Thread Jeff Newmiller
There is no "perhaps" about it. Nonsense phrases like "similar to logit, where I dont [sic] lose normality of the data" that lead into off-topic discussions of why one introduces transformations in the first place are perfect examples of why questions like this belong on a statistical theory dis

Re: [R] data transformation

2019-01-20 Thread Richard M. Heiberger
this might work for you newy <- sign(oldy)*f(abs(oldy)) where f() is a monotonic transformation, perhaps a power function. On Sun, Jan 20, 2019 at 11:08 AM Adrian Johnson wrote: > > I apologize, I forgot to mention another key operation. > in my matrix -1 to <0 has a different meaning while va

Re: [R] data transformation

2019-01-20 Thread David L Carlson
nt of Anthropology Texas A&M University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Adrian Johnson Sent: Sunday, January 20, 2019 8:02 AM To: r-help Subject: [R] data transformation Dear group, My question, perhaps is more of a statistical question using

Re: [R] data transformation

2019-01-20 Thread Adrian Johnson
I apologize, I forgot to mention another key operation. in my matrix -1 to <0 has a different meaning while values between >0 to 1 has a different set of meaning. So If I do logit transformation some of the positives becomes negative (values < 0.5 etc.). In such case, the resulting transformed ma

[R] data transformation

2019-01-20 Thread Adrian Johnson
Dear group, My question, perhaps is more of a statistical question using R I have a data matrix ( 400 x 400 normally distributed) with data points ranging from -1 to +1.. For certain clustering algorithms, I suspect the tight data range is not helping resolving the clusters. Is there a way to tran

Re: [R] data frame transformation

2019-01-07 Thread Andras Farkas via R-help
Thanks Bert this will do... Andras Sent from Yahoo Mail on Android On Sun, Jan 6, 2019 at 1:09 PM, Bert Gunter wrote: ... and my reordering of column indices was unnecessary:    merge(dat, d, all.y = TRUE)will do. Bert Gunter "The trouble with having an open mind is that people keep comi

Re: [R] data frame transformation

2019-01-06 Thread Bert Gunter
... and my reordering of column indices was unnecessary: merge(dat, d, all.y = TRUE) will do. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Jan 6, 20

Re: [R] data frame transformation

2019-01-06 Thread Bert Gunter
Like this (using base R only)? dat<-data.frame(id=id,letter=letter,weight=weight) # using your data ud <- unique(dat$id) ul = unique(dat$letter) d <- with(dat, data.frame( letter = rep(ul, e = length(ud)), id = rep(ud, length(ul)) ) ) merge(dat[,c(2,1,3)]

Re: [R] data frame transformation

2019-01-06 Thread K. Elo
Hi! Maybe this would do the trick: --- snip --- library(reshape2) # Use 'reshape2' library(dplyr)# Use 'dplyr' datatransfer<-data %>% mutate(letter2=letter) %>% dcast(id+letter~letter2, value.var="weight") --- snip --- Or did I misunderstood something? Best, Kimmo 2019-01-06, 13:16

[R] data frame transformation

2019-01-06 Thread Andras Farkas via R-help
Hello Everyone, would you be able to assist with some expertise on how to get the following done in a way that can be applied to a data set with different dimensions and without all the line items here? we have: id<-c(1,1,1,2,2,2,2,3,3,4,4,4,4,5,5,5,5)#length of unique IDs may differ of cours

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread Ahmed Attia
Thanks Bert, worked nicely. Yes, genotypes with only one ID will be eliminated before partitioning the data. Best regards Ahmed Attia On Mon, Aug 27, 2018 at 8:09 PM, Bert Gunter wrote: > Just partition the unique stand_ID's and select on them using %in% , say: > > id <- unique(dataGenoty

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread Bert Gunter
Sorry, my bad -- careless reading: you need to do the partitioning within genotype. Something like: by(dataGenotype, dataGenotype$Genotype, function(x){ u <- unique(x$standID) tst <- x$x2 %in% sample(u, floor(length(u)/2)) list(test = x[tst,], train = x[!tst,] }) This will give a

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread MacQueen, Don via R-help
And yes, I ignored Genotype, but for the example data none of the stand_ID values are present in more than one Genotype, so it doesn't matter. If that's not true in general, then constructing the grp variable is a little more complex, but the principle is the same. -- Don MacQueen Lawrence Live

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread MacQueen, Don via R-help
You could start with split() grp <- rep('', nrow(mydata) ) grp[mydata$stand_ID %in% c(7,9,67)] <- 'A-training' grp[mydata$stand_ID %in% c(3,18,20,21,32)] <- 'B-testing' split(mydata, grp) or perhaps grp <- ifelse( mydata$stand_ID %in% c(7,9,67) , 'A-training', 'B-testing' ) split(mydata, grp)

Re: [R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread Bert Gunter
Just partition the unique stand_ID's and select on them using %in% , say: id <- unique(dataGenotype$stand_ID) tst <- sample(id, floor(length(id)/2)) wh <- dataGenotype$stand_ID %in% tst ## logical vector test<- dataGenotype[wh,] train <- dataGenotype[!wh,] There are a million variations on this t

[R] r-data partitioning considering two variables (character and numeric)

2018-08-27 Thread Ahmed Attia
I would like to partition the following dataset (dataGenotype) based on two variables; Genotype and stand_ID, for example, for Genotype H13: stand_ID number 7 may go to training and stand_ID number 18 and 21 may go to testing. Genotypestand_IDInventory_date stemC mheight H13

Re: [R] Data frame with Factor column missing data change to NA

2018-06-14 Thread Bill Poling
859932257 Remove Good to go now, for the moment, big smile! Thank you for your help Sir. WHP From: Bill Poling Sent: Thursday, June 14, 2018 6:49 AM To: 'Jim Lemon' Cc: r-help (r-help@r-project.org) Subject: RE: [R] Data frame with Factor column missing data change to NA #Good

Re: [R] Data frame with Factor column missing data change to NA

2018-06-14 Thread Bill Poling
HX recommended savings Claim paid without PHX recommended savings MRC Amount MRC Amount Appreciate your help Sir. WHP From: Jim Lemon [mailto:drjimle...@gmail.com] Sent: Wednesday, June 13, 2018 8:30 PM To: Bill Poling Cc: r-help (r-help@r-project.org) Subject: Re: [R] Data frame with Fa

Re: [R] Data frame with Factor column missing data change to NA

2018-06-13 Thread Jim Lemon
Hi Bill, It may be that the NonAcceptanceOther, being a character value, has "" (0 length string) rather than NA. You can convert that to NA like this: df2$NonAcceptanceOther[nchar(df2$NonAcceptanceOther) == 0]<-NA Jim On Thu, Jun 14, 2018 at 12:47 AM, Bill Poling wrote: > Good morning. > > #I

[R] Data frame with Factor column missing data change to NA

2018-06-13 Thread Bill Poling
Good morning. #I have df with a Factor column called "NonAcceptanceOther" that contains missing data. #Not every record in the df is expected to have a value in this column. # Typical values look like: # ERS # Claim paid without PHX recommended savings # Claim paid without PHX recommended savin

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Ding, Yuan Chun
insem...@comcast.net] Sent: Monday, March 05, 2018 3:55 PM To: Bert Gunter Cc: Ding, Yuan Chun; r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two factorial design > On Mar 5, 2018, at 3:04 PM, Bert Gunter wrote: > > But of course the whole point of additivity is to

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread David Winsemius
erated from a partial two-by-two factorial > > > design: two levels for drug A (yes, no), two levels for drug B (yes, no); > > > however, data points are available only for three groups, no drugA/no > > > drugB, yes drugA/n

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Bert Gunter
t; > *From:* Bert Gunter [mailto:bgunter.4...@gmail.com] > *Sent:* Monday, March 05, 2018 2:27 PM > *To:* David Winsemius > *Cc:* Ding, Yuan Chun; r-help@r-project.org > > *Subject:* Re: [R] data analysis for partial two-by-two factorial design > > > > David: >

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Bert Gunter
ning > three separate T tests? > > > > > > Thank you so much!! > > > > > > Ding > > > > > > I need to analyze data generated from a partial two-by-two factorial > design: two levels for drug A (yes, no), two levels for drug B (yes, no); >

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread David Winsemius
o levels for drug A (yes, no), two levels for drug B (yes, no); > > however, data points are available only for three groups, no drugA/no > > drugB, yes drugA/no drugB, yes drugA/yes drug B, omitting the fourth group > > of no drugA/yes drugB. I think we can not investigate interacti

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Ding, Yuan Chun
-help-boun...@r-project.org] On Behalf Of Ding, Yuan Chun Sent: Monday, March 05, 2018 2:45 PM To: Bert Gunter; David Winsemius Cc: r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two factorial design Hi Bert and David, Thank you so much for willingness to spend some time on

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Ding, Yuan Chun
, March 05, 2018 2:27 PM To: David Winsemius Cc: Ding, Yuan Chun; r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two factorial design David: I believe your response on SO is incorrect. This is a standard OFAT (one factor at a time) design, so that assuming additivity (no

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Bert Gunter
> Replied on CrossValidated where this would be on-topic. > > -- > David, > > > > > > > From: Bert Gunter [mailto:bgunter.4...@gmail.com] > > Sent: Friday, March 02, 2018 12:32 PM > > To: Ding, Yuan Chun > > Cc: r-help@

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread David Winsemius
, > > > From: Bert Gunter [mailto:bgunter.4...@gmail.com] > Sent: Friday, March 02, 2018 12:32 PM > To: Ding, Yuan Chun > Cc: r-help@r-project.org > Subject: Re: [R] data analysis for partial two-by-two factorial design > > > [Atte

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Ding, Yuan Chun
= drug A + drug B? any suggestion is appreciated. From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Friday, March 02, 2018 12:32 PM To: Ding, Yuan Chun Cc: r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two factorial design [Attention

Re: [R] data analysis for partial two-by-two factorial design

2018-03-02 Thread Ding, Yuan Chun
Hi Bert, Thank you so much for your direction, I have asked a question on stackexchange website. Ding From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Friday, March 02, 2018 12:32 PM To: Ding, Yuan Chun Cc: r-help@r-project.org Subject: Re: [R] data analysis for partial two-by-two

Re: [R] data analysis for partial two-by-two factorial design

2018-03-02 Thread Bert Gunter
This list provides help on R programming (see the posting guide linked below for details on what is/is not considered on topic), and generally avoids discussion of purely statistical issues, which is what your query appears to be. The simple answer is yes, you can fit the model as described, but y

Re: [R] data analysis for partial two-by-two factorial design

2018-03-02 Thread Ding, Yuan Chun
Dear R users, I need to analyze data generated from a partial two-by-two factorial design: two levels for drug A (yes, no), two levels for drug B (yes, no); however, data points are available only for three groups, no drugA/no drugB, yes drugA/no drugB, yes drugA/yes drug B, omitting the fourt

Re: [R] Data Table Merge Help

2018-02-01 Thread Jeff Newmiller
I rarely use data.table, but I think the vignette for the package discusses rolling joins. Also, Google popped up [1]. [1] https://www.r-bloggers.com/understanding-data-table-rolling-joins/ -- Sent from my phone. Please excuse my brevity. On February 1, 2018 9:45:53 AM PST, "Graeve, Nick" wr

Re: [R] Data Table Merge Help

2018-02-01 Thread Bert Gunter
Did you search first? (This is suggested by the posting guide -- below -- prior to posting). "merge 2 data.tables in R" brought up what looked like useful stuff, in particular the merge() function for data tables. If this does not do what you want, it may help to explain why not. Alternatively,

[R] Data Table Merge Help

2018-02-01 Thread Graeve, Nick
Hello I'm not sure if this is an appropriate use of this mailing list or not, please let me know if it isn't.  I'm struggling to figure out how to merge two data tables based on max effective date logic compared to when a payment occurred.  My dtDistributions DT is a transactional dataset while

Re: [R] Data cleaning & Data preparation, what do R users want?

2017-12-11 Thread Robert Wilkins
Dominik (and others) If it is indeed still the biggest paint point, even in 2017, then maybe we can do something about that, with more efforts at different user interface design and try-outs with them on specialized datasets. [ The fact that in some specialties, such as clinical trials, for exampl

Re: [R] Data cleaning & Data preparation, what do R users want?

2017-11-30 Thread Dominik Schneider
I would agree that getting data into R from various sources is the biggest pain point. Even if there is an api, the results are not always consistent and you have to do lots of dimension checking to get it right. Or there isn't an open api at all and you have to hack it by web scraping or otherwise

Re: [R] Data cleaning & Data preparation, what do R users want?

2017-11-29 Thread Jim Lemon
Hi again, Typo in the last email. Should read "about 40 standard deviations". Jim On Thu, Nov 30, 2017 at 10:54 AM, Jim Lemon wrote: > Hi Robert, > People want different levels of automation in the software they use. > What concerns many of us is the desire for the function > "figure-out-what-th

Re: [R] Data cleaning & Data preparation, what do R users want?

2017-11-29 Thread Jim Lemon
Hi Robert, People want different levels of automation in the software they use. What concerns many of us is the desire for the function "figure-out-what-this-data-is-import-it-and-get-rid-of-bad-values". Such users typically want something that justifies its use by being written by someone who seem

Re: [R] Data cleaning & Data preparation, what do R users want?

2017-11-29 Thread Robert Wilkins
Christopher, OK, well what about a range of functions in an R package that automatically, with very little syntax, pulls in data from a variety of formats (CSV, SQLite, and so on) and converts them to an R data frame. You seem to be pointing to something like that. Something like that, in some

Re: [R] Data cleaning & Data preparation, what do R users want?

2017-11-29 Thread Bert Gunter
Oh Crap! I mistakenly replied onlist. PLEASE IGNORE -- these are only my ignorant opinions. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Nov 29,

  1   2   3   4   5   6   7   8   9   10   >