similar to: write a loop for tallies

Displaying 20 results from an estimated 20000 matches similar to: "write a loop for tallies"

2009 Nov 23
2
categorisation of continuous variables in R
Dear all, I'm looking for a function comparable to switch, to categorize a continuous variable in a few levels. Off course that can be done with a series of ifelse statements, but that looks rather clumsy. I looked at switch, but couldn't figure out how to use it for this. I guess that's not possible, as it only works with characters or integers, not with intervals. Basically,
2010 Feb 08
3
High codec translation times on x64
Hi Users, I was wondering if someone of you have the same thing on CentOS 64x? asterisk01*CLI> core show translation Translation times between formats (in microseconds) for one second of data Source Format (Rows) Destination Format (Columns) g723 gsm ulaw alaw g726aal2 adpcm slin lpc10 g729 speex ilbc g726 g722 siren7 siren14 slin16 g723
2012 Jan 13
4
Averaging within a range of values
Hello all. I have two data frames. Group Start End G1 200 700 G2 500 1000 G3 2000 3000 G4 4000 6000 G5 7000 8000 and Pos C0 C1 200 0.9 0.6 500 0.8 0.8 800 0.9 0.7 1000 0.7 0.6 2000 0.6 0.4 2500 1.2 0.8
2009 Jul 18
1
Plotting question
Hi I have a data set that needs to be plotted (see below) When I plot it using the simple plot(read_count ~ Cn), I get box plots for the read_count numbers plotted according to Cn. The Cn's on the x-axis are ordered: 10000, 100, 1000, 40, 400, 4000... How do I plot so that Cn is plotted on the x-axis in an ascending order: 40, 60, 80, .......10000? Thanks for your help. Anjan ID
2016 Aug 22
2
Milestone: 9000 packages on CRAN
An additional 1000 packages have been added to CRAN. This time, it took less than 6 months. Today (August 22, 2016), the Comprehensive R Archive Network (CRAN) [1] reports: ?Currently, the CRAN package repository features 9004 available packages.? The rate with which new packages are added to CRAN is increasing. During 2007-2009 we went from 1000 to 2000 packages in 906 days (1.1 per day) and
2016 Feb 29
2
Milestone: 8000 packages on CRAN
Another 1000 packages were added to CRAN, which took less than 7 months. Today (February 29, 2017), the Comprehensive R Archive Network (CRAN) [1] reports: ?Currently, the CRAN package repository features 8002 available packages.? The rate with which new packages are added to CRAN is increasing. In 2014-2015 we had 1000 packages added to CRAN in 355 days (2.8 per day), the following 1000
2010 Aug 31
1
Speeding up prediction of survival estimates when using `survifit'
Hi, I fit a Cox PH model to estimate the cause-specific hazards (in a competing risks setting). Then , I compute the survival estimates for all the individuals in my data set using the `survfit' function. I am currently playing with a data set that has about 6000 observations and 12 covariates. I am finding that the survfit function is very slow. Here is a simple simulation example
2010 May 27
2
clustering in R
i have a matrix with the following dimensions 136 3 and it looks something like [,1] [,2] [,3] [1,] 402 675 1.802758 [2,] 402 696 1.938902 [3,] 402 699 1.994253 [4,] 402 945 1.898619 [5,] 424 470 1.812857 [6,] 424 905 1.816345 [7,] 470 905 1.871252 [8,] 504 780 1.958191 [9,] 504 848 1.997111...............
2010 May 26
1
More efficient way to use ifelse()? - A follow up
# Thanks again to everyone who provided suggestions. # I was curious about which approaches would be the fastest... so a little benchmarking # My approach was by far the worst :) # The approach suggested by Duncan Murdoch and Peter Langfelder, based on indexing , was by far the fastest (~ 66times faster than using nested ifelse() ). All the details can be found below for those who are
2018 Apr 30
3
How to visualise what code is processed within a for loop
Luca, If speed is important, you might improve performance by making d0 into a true matrix, rather than a data frame (assuming d0 is indeed a data frame at this point). Although data frames may look like matrices, they aren?t, and they have some overhead that matrices don?t. I don?t think you would be able to use the [[nm]] syntax with a matrix, but [ , nm] should work, provided the matrix has
2018 Apr 30
0
How to visualise what code is processed within a for loop
Thank you for both replies Don & Rui, The very issue here is that there is a search that needs to be done within a text field and I agree with Rui later comment that regexpr might indeed be the time consuming piece of code. I might try to optimise this piece of code later on, but for the time being I am working on the following part of building a neural network to try indeed classifying some
2010 Aug 26
2
Problems when Apply a script to a list
Dear users, *******I have a function f to simulate data from a model (example below used only to show my problems) f<-function(n,mean1){ a<-matrix(rnorm(n, mean1 , sd = 1),ncol=5) b<-matrix(runif(n),ncol=5) data<-rbind(a,b) out<-data out} *********I want to simulate 1000 datasets (here only 5) so I use S<-list() for (i in 1:5){ S[[i]]<-f(n=10,mean1=0)} ******I have a
2016 Aug 22
1
Milestone: 9000 packages on CRAN
The entirety of humanity lives a little better today, because of problems solved using CRAN software. Some of those problems would still await solution, because some of the people involved in developing and disseminating those solutions would not have been as effective or efficient without CRAN and R. We're not just laying brick: We're building a cathedral. Spencer
2018 Apr 28
2
How to visualise what code is processed within a for loop
Thanks Don, for (i in 1:10){ nm <- paste0("V", i) d0[[nm]] <- ifelse( regexpr(d1[i,1], d0$X0) > 0, 1, 0) } is exaclty what I needed. Best regards, Luca 2018-04-25 23:03 GMT+02:00 MacQueen, Don <macqueen1 at llnl.gov>: > Your code doesn't make sense to me in a couple of ways. > > Inside the loop, the first line assigns a value to an
2018 Apr 28
2
How to visualise what code is processed within a for loop
I forgot to explain why my suggestion. The logical condition returns FALSE/TRUE that in R are coded as 0/1. So all you have to do is coerce to integer. This works because the ifelse will return a 1 or a 0 depending on the condition. Meaning exactly the same values. And is more efficient since ifelse creates both vectors, the true part and the false part, and then indexes those vectors in
2018 Apr 30
0
How to visualise what code is processed within a for loop
Hi Rui Thank you for your suggestion, I have tested the code suggested by you against that supplied by Don in terms of timing and results are very much aligned: to populate a 5954x899 0/1 matrix on my machine your procedure took 79 secs, while the one with ifelse employed 80 secs, hence unfortunately not really any significant time saved there. Nevertheless thank you for your contribution.
2018 Apr 25
0
How to visualise what code is processed within a for loop
Your code doesn't make sense to me in a couple of ways. Inside the loop, the first line assigns a value to an object named "t". Then, the second line does the same thing, assigns a value to an object named "t". The value of the object named "t" after the second line will be the output of the ifelse() expression, whatever that is. This has the effect of making
2010 May 26
1
data frame manipulation change elements meeting criteria
Dear group, Here is my df : trade <- structure(list(Trade.Status = c("DEL", "INS", "INS"), Instrument.Long.Name = c("SUGAR NO.11", "CORN", "CORN"), Delivery.Prompt.Date = c("Jul/10", "Jul/10", "Jul/10"), Buy.Sell..Cleared. = c("Sell", "Buy", "Buy"), Volume = c(1L, 2L,
2011 Aug 18
3
Coding question for behavioral data analysis
Hello all, I have a question which I have been struggling with for several weeks now, that I think might be easy for more proficient coders than myself. I have a large behavioral dataset, with behaviors and the times (milliseconds) that they occurred. Each subject has a separate file, and a sample subject file can be generated using the following syntax: Time <- c(1000, 1050, 1100, 1500, 2500,
2017 May 23
2
help pages base R not rendered correctly?
Hi all, Don't know if this is a known issue, but I couldn't find anything so I report anyway. When checking eg ?qr in both RStudio and the naked R IDE, the help page is rendered incorrectly. More specifically, any use of \bold{...} is printed as is, rather than interpreted as bold. Same happens on ?svd. According to the manual Writing R Extensions, this should still be recognized. When I