Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Goodale, Tom via R-help
Surely doing y <- 1 - x would be the simplest way? Best, Tom > -Original Message- > From: R-help On Behalf Of Rui Barradas > Sent: 19 May 2025 08:08 > To: paul zachos ; r-help@r-project.org > Subject: Re: [R] Looking for a function or a set of steps > > Às 1

Re: [R] R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments

2024-11-27 Thread Tom Woolman
Oh and don't forget: #first line of code, bring dplyr into memory after that package has been installed. library(dplyr) On Wednesday, November 27th, 2024 at 12:05 PM, Tom Woolman wrote: > > > Check out the dplyr package, specifically the mutate function. > > # Cre

Re: [R] R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments

2024-11-27 Thread Tom Woolman
Check out the dplyr package, specifically the mutate function. # Create new column based on existing column value df <- df %>% mutate(FirstDay = if(ID = 2, 5)) df Repeat as needed to capture all of the day/firstday combinations you want to account for. Like everything else in R, there are

Re: [R] How to do non-parametric calculations in R

2022-06-11 Thread Tom Woolman
Imagine that it's the year 2022 and you don't know how to look up information about performing a Kruskal-Wallis H test. It would take you longer to join the listserv and then write such a cokamemie email than to open the stats textbook you are supposed to have for the course, much less doing

Re: [R] categorizing data

2022-05-29 Thread Tom Woolman
Some ideas: You could create a cluster model with k=3 for each of the 3 variables, to determine what constitutes high/medium/low centroid values for each of the 3 types of plant types. Centroid values could then be used as the upper/lower boundary ranges for high/med/low. Or utilize a hist

Re: [R] Is there a canonical way to pronounce CRAN?

2022-05-04 Thread Tom Woolman
Everyone needs to speak English exactly like I do or else they're doing it wrong :) By I pronounce CRAN the same way that I pronounce the first half of cranberry. On 2022-05-04 20:24, Avi Gross via R-help wrote: Extended discussion may be a waste but speaking for myself, I found it highl

Re: [R] Combining data.frames

2022-03-19 Thread Tom Woolman
Have you looked at the merge function in base R? https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/merge On 2022-03-19 21:15, Jeff Reichman wrote: R-Help Community I'm trying to combine two data.frames which each containing 10 columns of which they each share two common fiel

Re: [R] Time for a companion mailing list for R packages?

2022-01-13 Thread Tom Woolman
KB or MB file size for attachments). Thanks, Tom On 2022-01-13 12:25, Eric Berger wrote: Re: constructive criticism to make this list more useful to more people: Suggestion 1: accommodate questions related to non-base-R packages This has been addressed by many alrea

Re: [R] Defining Parameters in arules

2021-11-23 Thread Tom Woolman
Greg Williams has a book titled "Data Mining with Rattle and R", which has a chapter on association rules and the arules package. Williams' Rattle GUI package for R also lets you define an association rules model using a graphical interface (which creates the R code for you in the log file for

Re: [R] Creating a log-transformed histogram of multiclass data

2021-08-03 Thread Tom Woolman
Apologies, I left out 3 critical lines of code after the randomized sample dataframe is created: group_a <- d[ which(d$label =='A'), ] group_b <- d[ which(d$label =='B'), ] group_c <- d[ which(d$label =='C'), ] On 2021-08-03 18:56, Tom Woolman wro

[R] Creating a log-transformed histogram of multiclass data

2021-08-03 Thread Tom Woolman
cale_x_continuous(name = "Log-scale Anomaly Score", trans="log2") + scale_y_continuous(trans="log2", name="Log-transformed Frequency Counts") + ggtitle("Transformed Anomaly Scores - Group C Only") # Group C transformed histogram is produce

Re: [R] [EXT] Re: Assigning categorical values to dates

2021-07-21 Thread Tom Woolman
sign of experiment and you want to perform an analysis that treats time as qualitative data. Quoting "N. F. Parsons" : @Tom Okay, yeah. That might actually be an elegant solution. I will mess around with it. Thank you - I’m not in the habit of using factors and am no

Re: [R] Assigning categorical values to dates

2021-07-21 Thread Tom Woolman
y, Washington State University Graduate Advocate, American Association of University Professors (OR) Recent work (https://www.researchgate.net/profile/Nathan_Parsons3/publications) Schedule an appointment (https://calendly.com/nate-parsons) On Wednesday, Jul 21, 2021 at 8:30 PM, Tom Woolman

Re: [R] Assigning categorical values to dates

2021-07-21 Thread Tom Woolman
Couldn't you convert the date columns to character type data in a data frame, and then convert those strings to factors in a 2nd step? The only downside I think to treating dates as factor levels is that you might have an awful lot of factors if you have a large enough dataset. Quoti

Re: [R] Using R to analyse Court documents

2021-07-20 Thread Tom Woolman
ssing) classification problem. The first challenge will be obtaining human-labeled training examples of a sufficient number of example documents. Thanks, Tom Quoting Brian Smith : Hi, I am wondering if there is some references on how R can be used to analyse legal/court documents. I searched a b

Re: [R] Windows path backward slash

2020-12-24 Thread Tom Woolman
In Windows versions of R/RStudio when refering to filename paths, you need to either use two "\\" characters instead of one, OR use the reverse slash "/" as used in Linux/Unix. It's an unfortunate conflict between R and Windows in that a single \ character by itself is treated as an esc

Re: [R] cooks distance for repeated measures anova

2020-12-23 Thread Tom Woolman
Hi Dr. Pedersen. I haven't used cook's on an aov object but I do it all the time from an lm (general linear model) object, ie.: mod <- lm(data=dataframe) cooksdistance <- cooks.distance(mod) I *think* you might be able to simulate an aov using the lm functon by selecting the parameter in

Re: [R] counting duplicate items that occur in multiple groups

2020-11-18 Thread Tom Woolman
Thanks, everyone! Quoting Jim Lemon : Oops, I sent this to Tom earlier today and forgot to copy to the list: VendorID=rep(paste0("V",1:10),each=5) AcctID=paste0("A",sample(1:5,50,TRUE)) Data<-data.frame(VendorID,AcctID) table(Data) # get multiple vendors for each acc

Re: [R] counting duplicate items that occur in multiple groups

2020-11-17 Thread Tom Woolman
in his "Bloom County" comic strip ) On Tue, Nov 17, 2020 at 3:29 PM Tom Woolman wrote: Hi Bill. Sorry to be so obtuse with the example data, I was trying (too hard) not to share any actual values so I just created randomized values for my example; of course I should have specified th

Re: [R] counting duplicate items that occur in multiple groups

2020-11-17 Thread Tom Woolman
uot;)) ? Must each vendor have only one account? If not, what should the result be for Data2 <- data.frame(Vendor=c("V1","V2","V3","V1","V4","V2"), Account=c("A1","A2","A2","A2","A3",&q

[R] counting duplicate items that occur in multiple groups

2020-11-17 Thread Tom Woolman
Hi everyone. I have a dataframe that is a collection of Vendor IDs plus a bank account number for each vendor. I'm trying to find a way to count the number of duplicate bank accounts that occur in more than one unique Vendor_ID, and then assign the count value for each row in the dataframe

[R] RIDIT scoring in R

2020-09-14 Thread Tom Woolman
Hi everyone. I'd like to perform RIDIT scoring of a column that consists of ordinal values, but I don't have a comparison dataset to use against it as required by the Ridit::ridit function. As a question of best practice, could I use a normally distributed frequency distribution table gen

Re: [R] Assigning cores

2020-09-03 Thread Tom Woolman
Hi Leslie and all. You may want to investigate using SparklyR on a cloud environment like AWS, where you have more packages that are designed to work on cluster computing environments and you have more control over those types of parallel operations. V/r, Tom W. Quoting Leslie

Re: [R] kernlab ksvm rbfdot kernel - prediction returning fewer rows than provided for input

2020-06-10 Thread Tom Woolman
. Quoting Tom Woolman : Hi everyone. I'm using the kernlab ksvm function with the rbfdot kernel for a binary classification problem and getting a strange result back. The predictions seem to be very accurate judging by the training results provided by the algorithm, but I'm unable to

[R] kernlab ksvm rbfdot kernel - prediction returning fewer rows than provided for input

2020-06-10 Thread Tom Woolman
Hi everyone. I'm using the kernlab ksvm function with the rbfdot kernel for a binary classification problem and getting a strange result back. The predictions seem to be very accurate judging by the training results provided by the algorithm, but I'm unable to generate a confusion matrix

[R] random forest significance testing tools

2020-05-10 Thread Tom Woolman
train[,1:29], nperm=99, ntree=500) Thanks in advance. Tom Woolman PhD student, Indiana State University __ 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

Re: [R] Question about "sample" function and inconsistent results I am getting across machines.

2020-05-03 Thread Fomby, Tom
Thank you so much Duncan. I will pitch in. Tom From: Duncan Murdoch Sent: Sunday, May 3, 2020 2:56 PM To: Fomby, Tom; r-help@R-project.org Subject: Re: [R] Question about "sample" function and inconsistent results I am getting across machines. On

Re: [R] Question about "sample" function and inconsistent results I am getting across machines.

2020-05-03 Thread Fomby, Tom
trace the version of sample() in my ASUS computer. Me running on 3.6.3 did not fix things because of its determined adherence to the buggy version. Much appreciation, Tom Fomby Department of Economics SMU From: Duncan Murdoch Sent: Sunday, May 3, 2020 2:36

Re: [R] Question about "sample" function and inconsistent results I am getting across machines.

2020-05-03 Thread Fomby, Tom
using the sample function. By the way, how is it that one can take a membership in the R community so as to provide support for volunteers like yourself. Thank you, Tom Fomby Department of Economics SMU Dallas, TX 75275 From: Duncan Murdoch Sent: Sunday, M

[R] Question about "sample" function and inconsistent results I am getting across machines.

2020-05-03 Thread Fomby, Tom
g not knowing which partitions of the data are being used by the student. Thank you for considering my question. Sincerely, Tom Fomby Professor of Economics SMU Dallas, TX 75275 tfo...@smu.edu [[alternative HTML version deleted]] __ R-h

[R] Problem witth nnet:multinom

2019-06-21 Thread Tom Woolman
I am using R with the nnet package to perform a multinomial logistic regression on a training dataset with ~5800 training dataset records and 45 predictor variables in that training data. Predictor variables were chosen as a subset of all ~120 available variables based on PCA analysis. My t

[R] Trying to fix code that will find highest 5 column names and their associated values for each row in a data frame in R

2018-12-17 Thread Tom Woolman
I have a data frame each with 10 variables of integer data for various attributes about each row of data, and I need to know the highest 5 variables related to each of row in this data frame and output that to a new data frame. In addition to the 5 highest variable names, I also need to kn

Re: [R] legend order in ggplot2

2018-05-27 Thread Tom Hopper
, "name_b", "name_a", "name_c”)) my_lines <- c(name_a = "solid", name_b = "dotted", name_c = "twodash") ggplot(my_df, aes(x = x, y = val, linetype = var)) + geom_line() + scale_linetype_manual(values = my_lines) Regards, Tom >

[R] Using Tobit and SUR in Systemfit in R

2018-05-10 Thread Tom Kopp
unrelated regression ("SUR") specification. However, I consider it more appropriate to estimate the cost function via OLS and the cost share equations via TOBIT due to some peculiarities of the data (but still as SUR). I am looking forward to your replies!! Warm regards, Tom (I have

Re: [R] Missing information in source()

2017-11-08 Thread Tom Backer Johnsen
Hello Thank you all for most useful responses. I was looking for answers in the wrong place, that is why I have not responded before! Tom Backer Johnsen > On 7 Nov 2017, at 21:25, Rui Barradas wrote: > > Hello, > > Try > > print(head(...)) > > Hope this helps

[R] Missing information in source()

2017-11-07 Thread Tom Backer Johnsen
Dear R-help, I am running a Mac under Sierra, with R version 3.4.2 and RStudio 1.1.383. When running head () or tail () on an object in a script using source (

[R] R-Package for Recursive Partitioning without Classification or Regression

2017-07-28 Thread Tom D. Harray
Hello, I have a question related to recursive partitioning, but I cannot find an answer, likely because I don't know how to properly word my Google search query. All recursive partitioning examples, which I can find, are used for either classification or regression trees like library(tree)

[R] Partial Fraction Decomposition

2016-11-26 Thread Tom Mosca
ction decomposition of P/Q? For example: Given (3x^3+x^2-8x+6)/(x^2)(x-1)^2 Return 4/x + 6/x^2 � 1/(x-1) + 2/(x-1)^2 Thank you, Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

[R] Euler & Runge-Kutta

2016-11-07 Thread Tom Mosca
Can someone help me with R code to perform approximations to second order differential equations and systems of first order differential equations using Euler's method and Runge-Kutta? I am not a student and this is not for a test or graded assignment. Examples (unrelated to each other): h =

Re: [R] install R in relative path

2016-11-03 Thread Tom Graves via R-help
job which would untar it into something like ./R_install/  I need to point to that ./R_install/bin/Rscript.   I am currently using R-3.2.1 so I'll try upgrading too. Thanks,Tom On Wednesday, October 19, 2016 3:38 AM, Martin Maechler wrote: >>>>> Tom Graves via

Re: [R] install R in relative path

2016-10-19 Thread Tom Graves via R-help
Thanks.  I will give this a try.  I was doing the install step and trying to configure the relative path before. Tom On Wednesday, October 19, 2016 3:38 AM, Martin Maechler wrote: >>>>> Tom Graves via R-help >>>>>    on Tue, 18 Oct 2016 21:06:54 + wr

[R] install R in relative path

2016-10-18 Thread Tom Graves via R-help
ried a few things but the things I had tried didn't work. Are there any options to configure or PATHs I could use to do this? Any help is appreciated. Thanks,Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list --

Re: [R] Arules Package: Rules subset with 'empty' left hand side (lhs)

2016-09-13 Thread Tom D. Harray
ot;)) returns the 3 rules with empty lhs. Hello Martin, I add you to this thread, because the arules::subset() behaviour appears to me to be a bug in arules. And I'd like to suggest to add an explanation/example to arules::subset() help. Cheers, Dirk On 13 September 2016 at 05:10,

[R] Arules Package: Rules subset with 'empty' left hand side (lhs)

2016-09-12 Thread Tom D. Harray
Hello, subsets of association rules (with respect to support, confidence, lift, or items) can be obtained with the arules::subset() function; e.g. rm(list = ls(all.names = TRUE)) library(arules) set.seed(42) x <- lapply(X = 1:500, FUN = function(i) sample(x = 1:10, size = sample(1:5,

[R] Same code on Mac?

2016-09-01 Thread Tom Mosca
Using a PC I have written the R code for my elementary statistics students. One of the students has a Mac. Should the same lines of code work on a Mac? Where can the student find support for R on her Mac? I don't know anything about them, and have never used one. Thank you. [[al

Re: [R] R3.3.1 - Windows10 OS - Overriding default Legend title with user specified title

2016-07-26 Thread Tom Wright
A quick google for "ggplot2 change legend text" turns up several hits. This stackexchange question has several recipes. http://stats.stackexchange.com/questions/5007/how-can-i-change-the-title-o f-a-legend-in-ggplot2 including the correct use of the labs() function; labs(aesthetic='BrandValue in B

Re: [R] Date Time in R

2016-07-26 Thread Tom Wright
- wday(a1$date) # note can’t have spaces in variable names week_names <- wday(a1$date, label=TRUE) *From:* Shivi Bhatia [mailto:shivipm...@gmail.com] *Sent:* July 26, 2016 12:16 PM *To:* Tom Wright *Cc:* David L Carlson ; r-help *Subject:* Re: [R] Date Time in R Hello Tom, Please

Re: [R] Date Time in R

2016-07-26 Thread Tom Wright
Hi again Shiva, I think what we need to see is the output from: str(eid$date) and perhaps head(eid$date) If you can send this information before doing any processing on the date (i.e. before the as.Date() function) we may be able to help. -Original Message- From: R-help [mailto:r-help

Re: [R] Issue with Transform function in R

2016-07-21 Thread tom
Not sure I can translate the format of your Date column correctly, however the command DF1$Date <- as.Date(DF1$Date, format=’formatstr’) Will convert the dates into a format correctly handled by R. ?strptime Should give you an idea of what formatstr should look like. I.e. if date = 160721 as.

Re: [R] txtProgressBar()

2016-07-21 Thread tom
You may like to look at ?suppressMessages P.S. sorry for posting in HTML, new laptop and it’s next on my list of things to fix. From: Ivan Calandra [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE a

[R] Geom_smooth

2016-07-20 Thread Tom Subia
Default level = 0.95. Does this mean +/- 0.025 from estimate? [[alternative HTML version deleted]] __ 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

Re: [R] means by year, month and day

2016-07-18 Thread Tom Mosca
Dear William, The line of code you composed works perfectly, as you knew it would. Thank you for your kind response. I will now endeavor to forget that other function exists. Sincerely, Tom From: William Dunlap [wdun...@tibco.com] Sent: Monday, July 18

Re: [R] means by year, month and day

2016-07-18 Thread Tom Mosca
do want to develop better form. So, I'll keep working on it. Thank you for your kind response and examples. I will study them. Sincerely, Tom From: jim holtman [jholt...@gmail.com] Sent: Sunday, July 17, 2016 7:14 PM To: Jianling Fan Cc: Tom Mosca;

[R] means by year, month and day

2016-07-17 Thread Tom Mosca
3.0 10 2015 1 1 9 272 8.8 9.6 1025.4 3.2 -3.3 � The first four columns are year, month, day, hour (0 � 23). I wish to take the means of the next six columns (WDIR, WSPD, GST, PRES, ATMP and DEWP) by year, month and day. That is, I want daily averages. Please help. Thank you.

[R] daily means, follow-up

2016-07-17 Thread Tom Mosca
Solved it myself: aggregate(mydata, by=mydata[c("MM","DD")], FUN=mean) Thank you. # - My dataframe looks like this: > mydata X.YY MM DD hh WDI R.WSP D.GST PRES ATMP DEWP 12015 1 1 0 328 3.6 4.5 102

Re: [R] Excluding coordinates that fall within a circle

2016-06-17 Thread Tom Wright
I'm no expert here but I have recently been playing with the package 'geosphere' it contains plenty of options to calculate distance between two coordinates specified as lat and long. install.packages('geosphere') # only needed once library(geosphere) coord1 <- c(43.60923,-79.322799) coord2 <- c(

Re: [R] Building a binary vector out of dichotomous variables

2016-06-16 Thread Tom Wright
Does this do what you want? as.numeric(with(ds_example,paste(1,year2013,year2014,year2015,sep=''))) On Thu, Jun 16, 2016 at 8:57 AM, wrote: > Hi All, > > I need to build a binary vector made of a set of dichotomous variables. > > What I have so far is: > > -- cut -- > > ds_example <- > struct

Re: [R] strange error message when using rnorm and rbinom

2016-06-14 Thread Tom Wright
As you probably already guessed we are going to need to see the contents of nref, mu.m2 and disp.m2 to help. dput(nref) dput(mu.m2) dput(disp.m2) k might help too. On Tue, Jun 14, 2016 at 2:06 PM, JI Cho wrote: > Dear R users, > > I have been using rnorm, rbinom and have been getting the followi

Re: [R] Closing FTP sessions with RCurl

2016-06-14 Thread Tom Wright
No expert here, and this isn't tested. It seems you can set the forbid.reuse option which will cause curl to shutdown the connection after transfer is complete. if(url.exists("http://www.omegahat.net/RCurl/index.html";)) { curl <- getCurlHandle() curlSetOpt(.opts=list(forbid.reuse=1),curl=cu

Re: [R] VIM package

2016-06-09 Thread Tom Wright
Did you install the package before loading it? install.packages("VIM") On Thu, Jun 9, 2016 at 1:19 PM, Ayyappa Chaturvedula wrote: > Dear R users, > I am trying to use VIM (Visualization and Imputation of Missing Values) > package in R. When I try to install the VIM library (library(VIM)), I am

Re: [R] Problem loading aplpack library

2016-06-09 Thread Tom Wright
Assuming you are on a mac this link may be of assistance: http://tips.tutorialhorizon.com/2015/10/01/xcrun-error-invalid-active-developer-path-library-developer-commandline-tools-missing-xcrun/ On Wed, Jun 8, 2016 at 7:14 PM, David Howell wrote: > I am having trouble running aplpack on my Mac. It

Re: [R] How to import sensitive data when multiple users collaborate on R-script?

2016-05-31 Thread Tom Wright
My general approach to this is to put the function for loading data into a separate file which is then sourced in the main analysis file. Occasionally I'll use a construct like: if file.exists("loadData_local.R") { source("loadData_local.R") }else{ source("loadData_generic.R") } Whe

Re: [R] Shaded areas in R

2016-05-26 Thread Tom Wright
Hi Óscar, Not really sure what you mean by the time variable being a "character" vector. Unless you are plotting a barchart or boxplot (or similar), I don't this this makes sense. If you can post a sample of your data, preferably using the dput() command we can probably help more. On Thu, May 26,

Re: [R] strange error

2016-05-25 Thread Tom Wright
It may not be the problem, but with RStudio this error pops up when the area reserved for plotting is too small. Typically this area is in the right hand column, if you have this minimised (perhaps to maximise space for typing) you will hit this problem. Try making it bigger. Edit: Just ran your c

Re: [R] identify duplicate entries in data frame and calculate mean

2016-05-24 Thread Tom Wright
Don't see that as being a big problem. If your data grows then dplyr supports connections to external databases. Alternately if you just want a mean, most databases can do that directly in SQL. On Tue, May 24, 2016 at 4:17 PM, Matthew wrote: > Thank you very much, Tom. > This gets

Re: [R] identify duplicate entries in data frame and calculate mean

2016-05-24 Thread Tom Wright
Using dplyr $ library(dplyr) $ x<-data.frame(Length=c(321,350,340,180,198), ID=c(rep('A234',3),'B123','B225') ) $ x %>% group_by(ID) %>% summarise(m=mean(Length)) On Tue, May 24, 2016 at 3:46 PM, Matthew wrote: > I have a data frame with 10 columns. > In the last colum

Re: [R] ggplot2 not displaying graph in RH7 RStudio Server 3.2.3

2016-05-19 Thread Tom Wright
I just tested your code on my debian install with no problems. RStudio server logs messages to /var/log/messages (on redhat). Does running: $ cat /var/log/messages |grep rsession $ cat /var/log/messages |grep rserver in the shell give any clues? R version 3.2.5 (2016-04-14) Platform: x86_64-p

Re: [R] Warning when running R - can't install packages either

2016-05-12 Thread Tom Hopper
setInternet2() first thing after launching R might fix that. > On May 12, 2016, at 07:45, Alba Pompeo wrote: > > Hello. > > I've tried to run R, but I receive many warnings and can't do simple > stuff such as installing packages. > > Here's the full log when I run it. > > http://pastebin.com

Re: [R] Create a new variable and concatenation inside a "for" loop

2016-05-02 Thread Tom Wright
As pointed out somewhere in the replies to this you can always use the exists() function. for(i in 1:5){ if(exists(output)){ output <- c(output, i ) }else{ output <- i } } On Wed, Apr 27, 2016, 11:15 AM Gordon, Fabiana < fabiana.gor...@imperial.ac.uk> wrote: > Hello, > >

Re: [R] how to use AND in grepl

2016-05-02 Thread Tom Wright
o change this behaviour. On Mon, May 2, 2016 at 11:01 AM, wrote: > I just changed all the names in Command to lowercase, then this > str_extract works fine for "pd" and "t2", but not for "PDT2". Do you have > any idea how I can bring PDT2 also in str_ext

Re: [R] how to use AND in grepl

2016-05-02 Thread Tom Wright
PDT2')// I create a vector with these conditions > str_extract(df$Command,paste(v1,collaps='|')) //returning patterns, > using stringr library > > here I see no pattern named PDT2 but there are only PD and t2 patterns. > On Monday, May 2, 2016 8:18 AM, Tom Wright wro

Re: [R] how to use AND in grepl

2016-05-02 Thread Tom Wright
e size is not 0. It seems that this AND does not work. > > > On Monday, May 2, 2016 5:05 AM, peter dalgaard wrote: > > On 02 May 2016, at 12:43 , ch.elahe via R-help > wrote: > > > Thanks for your reply tom. After using > Subset(df,grepl("(.*t2.*pd.*)|(.*pd.*t2.*)"

Re: [R] inserting row(column) in array or dataframe at specified row(column)

2016-05-01 Thread Tom Wright
If you can address your columns by name then order shouldn't matter. If the column order does matter, perhaps a matrix is a better structure to use? On Sun, May 1, 2016, 10:56 AM Jan Kacaba wrote: > Hello dear R users, > > Is there a function or package which can insert row, column or array in >

Re: [R] row names, coulmn names

2016-05-01 Thread Tom Wright
I think what you ask isn't ideal.Each column in a dataframe should be the same data type. While column names are stored in the first row when the df is exported to CSV, they are not stored as columns in the data frame. Instead the column names are stored as a separate attribute of the df. This is w

Re: [R] how to use AND in grepl

2016-04-30 Thread Tom Wright
$Command) On Sat, Apr 30, 2016, 7:07 PM Tom Wright wrote: > subset(df,grepl("t2|pd",x$Command)) > > > On Sat, Apr 30, 2016 at 2:38 PM, ch.elahe via R-help > wrote: > >> Hi all, >> >> I have one factor variable in my df and I want to extract the names

Re: [R] how to use AND in grepl

2016-04-30 Thread Tom Wright
subset(df,grepl("t2|pd",x$Command)) On Sat, Apr 30, 2016 at 2:38 PM, ch.elahe via R-help wrote: > Hi all, > > I have one factor variable in my df and I want to extract the names from > it which contain both "t2" and "pd": > > 'data.frame': 36919 obs. of 162 variables >$TE:

Re: [R] Removing NAs from dataframe (for use in Vioplot)

2016-04-30 Thread Tom Wright
Never let it be said there's only one way to do a thing: require(ggplot2) require(dplyr) #create a sample dataset dat <- data.frame(y1=sample(c(1:10,NA),20,replace=TRUE), y2=sample(c(1:10,NA),20,replace=TRUE), y3=sample(c(1:10,NA),20,replace=TRU

Re: [R] Error using RPostgreSQL

2016-04-22 Thread Tom Wright
On heroku the database uri is stored in an environment variable. > db_uri = Sys.getenv(''DATABASE_URL') I'm not sure if you can use that directly or if you will need to parse it for username, password etc. On Thu, 2016-04-21 at 16:49 +0100, Izaak Rogan wrote: > Hi, > > I'm having trouble connec

Re: [R] Finding Highest value in groups

2016-04-22 Thread Tom Wright
Assuming your dataframe is in a variable x: > require(dplyr) > x %>% group_by(ID) %>% summarise(maxVal = max(Value,na.rm=TRUE)) On Fri, 2016-04-22 at 13:51 +, Saba Sehrish via R-help wrote: > Hi > > > I have two columns in data frame. First column is based on "ID" assigned to > each grou

Re: [R] Problem with X11

2016-04-19 Thread Tom Wright
I don't have my debian box available so can't confirm. But I would try $apt-get install libpng On Tue, Apr 19, 2016 at 11:23 AM, Lorenzo Isella wrote: > Dear All, > I have never had this problem before. I run debian testing on my box > and I have recently update my R environment. > Now, see what

[R] Unequal column lengths

2016-04-14 Thread Tom Mosca
to do is generate a table containing mean, median, mode, standard deviation, min, max and count, all per column. Thank you, Tom Example data Dat1 Dat2 Dat3 1154 2779 3335 42 NA 5 59 NA NA [[alternative HTML version deleted

Re: [R] how to find the mean and sd :(

2015-09-11 Thread Tom Wright
On Fri, 2015-09-11 at 07:48 -0700, massmatics wrote: > AM.warpbreaks<=30 The above command is not returning what you expected, what part of the AM.warpbreaks dataframe is expected to be <= 30? Effectively you are using a two stage process. 1) Create a logical vector identifying rows in the datafr

[R] trojan with R download

2015-07-31 Thread tom walk
I am working in China for a month and needed to download an earlier version of R in order to use Deseq2 and its requirements. The download got to the last few seconds and hung up. A trojan was found. It could be coincidence that it happened when I was downloading R, or perhaps a man in the mi

[R] Problem accessing xslx on CRAN mirrir

2015-07-14 Thread Knox, Tom
message: In open.connection(con, "r") : cannot open: HTTP status was '0 (nil)' I do not seem to be able to get past this issue, though am able to load the mh1823 POD package successfully from local zip file Regards, Tom Tom Knox NDE Subject Matter Expert Upstream Engineering

Re: [R] [R-sig-Fedora] Building R-3.2.0 from source.

2015-05-11 Thread Tom Callaway
'm building anything for end-of-lifed Fedora releases, though I understand your predicament. That said, I am still building for EL5, which is older than Fedora 17, so you could try to rebuild the R src.rpm from koji. If it does not work properly, let me know, and I will try to

Re: [R] [R-sig-Fedora] Building R-3.2.0 from source.

2015-05-10 Thread Tom Callaway
I just landed in Paris, and haven't read backwards in this thread, but I've done 3.2.0 builds for all current Fedora releases, they're all in updates-testing (I think the Fedora 22 builds are in updates stable now). The thing that changed is that R doesn't bundle a number of libraries like it u

Re: [R] How to obtain a cross tab count of unique values

2015-03-31 Thread Tom Wright
table(unique(df)$PROJECT) On Tue, 2015-03-31 at 14:51 -0500, Walter Anderson wrote: > I have a data frame that shows all of the parks (including duplicates) > that are impacted by a projects 'footprint': > > PROJECT PARKNAME > A PRK A > A PRK B > A PRK A > B PRK C > B

Re: [R] data.frame: data-driven column selections that vary by row??

2015-03-31 Thread Tom Wright
Not entirely sure I understand your problem here (your first email was a lot of reading). Would it make sense to add an extra column device_name Thus ending up with something like: Host Device Type host_Aada0ssd host_Aada1ssd host_Aada2hdd ... host_Nda3 ssd

Re: [R] data.frame: data-driven column selections that vary by row??

2015-03-31 Thread Tom Wright
Nice clean-up!!! On Tue, 2015-03-31 at 14:19 -0400, Ista Zahn wrote: > library(tidyr) > library(dplyr) > bw <- gather(bw, key = "tmp", value = "value", > matches("^d[a-z]+[0-9]+")) > bw <- separate(bw, tmp, c("disc", "var"), "_", extra = "merge") > bw <- spread(bw, var, value) ___

Re: [R] Randomly interleaving data frames while preserving order

2015-03-31 Thread Tom Wright
samples<-sample(c(rep(1,10),rep(2,10),rep(3,10)),30) samples[samples==1]<-1001:1010 samples[samples==2]<-2001:2010 samples[samples==3]<-3001:3010 fullDf<-rbind(df1,df2,df3) fullDf[sort(order(samples),index.return=TRUE)$ix,] On Tue, 2015-03-31 at 13:05 -0400, Kevin E. Thorpe wrote: > Hello. > >

Re: [R] summary.formula()

2015-03-18 Thread Tom Wright
First you need to make the data pbc available, perhaps by: data(pbc, package="survival") Then the line: sf2<-summary(... looks wrong, usually you would use the summary() function to look at the output from a function, seems to me you are missing the function here. I have no idea what this functi

Re: [R] reading multiple text files from web

2015-03-18 Thread Tom Wright
I think you need to use a loop to iterate through each of the items in getlinks for(link in getlinks) { url<-paste0('http://spec.org/jEnterprise2010/results/',link) output<-readfiles(url) } You're probably also going to need to add some error handling when your sea

Re: [R] Requesting function for A/B testing

2015-03-06 Thread Tom Wright
I can answer this: sample(c(0,1),1) On Fri, 2015-03-06 at 15:04 +0530, Namratha K wrote: > Dear Sir/Madam, > I am a student pursuing MCA .As i am doing an project using R language .I > want to implement A/B testing using R language.I am searching in google > from past few days and not able to imp

Re: [R] plotting the one-dimensional density of events in time

2015-03-06 Thread Tom Wright
plot(density(as.numeric(dd)), axes=FALSE, xlim=c(as.numeric(as.Date("2014-01-01")), as.numeric(as.Date("2014-12-30"))) rug(as.numeric(dd)) axis(side=1, at=seq(from=as.numeric(as.Date('2014-01-01')), to=as.numeric(as.Date('2014-12-1')),length.out=12), lab

Re: [R] problem with function that adds rows to dataframe based on conditional statement

2015-03-06 Thread Tom Wright
If all you want is to add a row of na's could you just do something like: nExpectedRows<-length(unique(animals)) * length(unique(animalYears)) * 2 newDf<-data.frame(animals=rep(NA,nExpectedRows-nrow(comAn)), animalYears=rep(NA,nExpectedRows-nrow(comAn)), animal

Re: [R] Still trying to avoid loops

2015-02-04 Thread Tom Wright
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Wright > Sent: Wednesday, February 4, 2015 2:08 PM > To: Rui Barradas > Cc: r-h...@stat.math.ethz.ch > Subject: Re: [R] Still trying to avoid loops > > Thanks, I was not aware of

Re: [R] Still trying to avoid loops

2015-02-04 Thread Tom Wright
; S D visit > 1 a 5 1 > 2 a 1 2 > 3 b 3 1 > 4 c 2 1 > 5 c 3 2 > 6 c 4 3 > > > > > Jim Holtman > Data Munger Guru > > What is the problem that you are trying to solve? > Tell me what you want to do, not how you want to do it. &

Re: [R] Still trying to avoid loops

2015-02-04 Thread Tom Wright
> > > Aren't the levels of your example wrong? If the levels are > > levels=c('a','b','c'), not c('b', 'a', 'c'), then the following will do the > > job. > > > > unname(unlist(tapply(dat$D, dat$S, or

Re: [R] Still trying to avoid loops

2015-02-04 Thread Tom Wright
,'b','c'), not c('b', 'a', 'c'), then the following will do > the job. > > unname(unlist(tapply(dat$D, dat$S, order))) > > > Hope this helps, > > Rui Barradas > > Em 04-02-2015 19:34, Tom Wright escreveu: > > G

Re: [R] Teaching materials for R course

2015-02-04 Thread Tom Wright
For the introduction to R I strongly suggest you look at the materials published by software-carpentry www.software-carpentry.org. The lessons are all open-source, hosted on github and are under active development. On Tue, 2015-02-03 at 12:08 +0100, Michael Haenlein wrote: > Dear all, > > I am Pr

  1   2   3   4   5   6   7   >