similar to: Applying function to only numeric variable (plyr package?)

Displaying 20 results from an estimated 1100 matches similar to: "Applying function to only numeric variable (plyr package?)"

2013 Jul 18
1
Bland Altman summary stats for all column combinations
Hello, I have the following data.frame structure(list(Study = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
2009 Mar 03
1
profiler and loops
Hello, (This is follow up from this thread: http://www.nabble.com/execution-time-of-.packages-td22304833.html but with a different focus) I am often confused by the result of the profiler, when a loop is involved. Consider these two scripts: script1: Rprof( ) x <- numeric( ) for( i in 1:10000){ x <- c( x, rnorm(10) ) } Rprof( NULL ) print( summaryRprof( ) ) script2:
2016 Nov 18
2
problem with normalizePath()
>>>>> Evan Cortens <ecortens at mtroyal.ca> >>>>> on Thu, 17 Nov 2016 15:51:03 -0700 writes: > I wonder if this could be related to the issue that I > submitted to bugzilla about two months ago? ( > https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17159) > That is to say, could it be that it's treating the first >
2016 Nov 30
1
problem with normalizePath()
I found this as well. At our institution, our home directories are on network shares that are mapped to local drives. The default, it appears, is to set the location for libraries (etc) to the network share name (//computer//share/director/a/b/user) rather than the local drive mapping (H:/). Given the issue with dir.create(), this means it's impossible to install packages (since it tries to
2016 Nov 17
2
problem with normalizePath()
The packages "readxl" and "haven" (and possibly others) no longer access files on shared network drives. The problem appears to be in the normalizePath() function. The file can be read from a local drive or by functions that don't call normalizePath(). The error thrown is Error: path[1]="\\Hzndhhsvf2/data/OCPH/EPI/BHSDM/Group/17.xls": The system cannot find the
2010 Apr 07
1
unexpected behaviour with ddply and colwise
Hi, I am confused by results from: > ddply(aa, names(aa), colwise(sum)) I thought ddply was just calling colwise(sum)() with each column. However ddply() returns a 13 x 5 result !! The general result I expected is similar to that of apply() , or using colwise(sum)() alone. Shouldn't ddply() produce the same ? Thanks in advance for your help, - Stuart Andrews >
2012 Dec 03
2
Excluding all missing values with dcast ("reshape2" package)
Hello--I'm doing a simple crosstab using dcast: rawfreq <- dcast(nh11brfs, race3~CHCCOPD, length) with the results race3 Yes No NA 1 White non-Hispanic 446 5473 21 2 Other non-Hispanic 29 211 0 3 Hispanic 6 81 1 4 <NA> 10 83 1 How would I modify this call to exclude all missing values; that is, to obtain race3
2011 May 18
1
Overlaying maps
I'm having difficulty overlaying maps when writing to a file graphics device. My command sequence has the structure plot(map1) par(new = T) plot(map2) On the screen device, it works fine. When I attempt something like png(file = "map.png") plot(map1) par(new = T) plot(map2) dev.off() only the last map appears, the previous ones having been cleared. Can someone clarify? Thanks,
2009 Nov 19
1
problem post request with RCurl
Hi, I am trying to use a CGI service (Pubchem PUG) via RCurl and am running into a problem where the data must be supplied via POST - but I don't know the keyword for the argument. The data to be sent is an XML fragment. I can do this via the command line using curl: I save the XML string to a file called query.xml and then do curl -d @query.xml
2018 Feb 12
2
What does pct mean?
Hi Carsten, On 02/11/2018 at 07:46 PM Carsten Bock wrote: > Hi, > > Lost percent (%).... Are you sure? I'm seeing here: ...........Receive......... .........Transmit.......... Count Lost Pct Jitter Count Lost Pct Jitter RTT.... 188K 0 0 0.000 188K 16641K 8809 0.000 0.026 => This doesn't sound reliable to me: there are 188K packets and 16641K
2018 Feb 13
2
What does pct mean?
On 02/13/2018 at 08:41 AM Floimair Florian wrote: > No you're reading it wrong. > > There are 188K received with no loss, and 16441K transmitted. This doesn't make any sense to me, either. There can't be more packages transmitted than received. It's the same codec in and out and it's been running exactly the same time. > ...........Receive.........
2010 Sep 11
5
for loop
Hello, I have a simple question: I want to list numbers 1:k, but if k <1, I hope nothing listed. how should we do? k=2 for (i in 1:k)  print(i) [1] 1    # <-correct [1] 2 k=0 for (i in 1:k) print(i) [1] 1      #<---- wrong [1] 0   thanks jian [[alternative HTML version deleted]]
2018 Feb 13
3
What does pct mean?
Could this gap in sequence numbers caused by a codec change generate errors like the one below? [2018-02-13 12:57:43] WARNING[4917][C-0004c2cb] codec_sangoma.c: [526559][g722toulaw] Got Seq 15944 but expecting 10106 (time since last read = 0ms), dropped 5838 packets On 02/13/2018 01:24 PM, Andres wrote: > On 2/13/18 11:55 AM, Michael Maier wrote: >> On 02/13/2018 at 08:41 AM Floimair
2009 Dec 02
2
Extracting vectors from a matrix (err, I think) in RMySQL
I have a query which returns a data set like so: > salaries yearID POS pct 1 2009 RF 203 2 2009 DH 200 3 2009 1B 198 4 2009 3B 180 5 2009 LF 169 6 2009 SS 156 7 2009 CF 148 8 2009 2B 97 9 2009 C 86 10 2008 DH 234 11 2008 1B 199 12 2008 RF 197 13 2008 3B 191 14 2008 SS 180 15 2008 CF 164 16 2008 LF 156 17 2008 2B 104 18 2008
2023 Oct 15
2
Create new data frame with conditional sums
Under the hood, sapply() is also a loop (at the interpreted level). As is lapply(), etc. -- Bert On Sun, Oct 15, 2023 at 2:34?AM Jason Stout, M.D. <jason.stout at duke.edu> wrote: > > That's very helpful and instructive, thank you! > > Jason Stout, MD, MHS > Box 102359-DUMC > Durham, NC 27710 > FAX 919-681-7494 > ________________________________ > From: John
2018 Feb 11
2
What does pct mean?
Hello, could somebody please tell me the meaning of "Pct" as seen in asterisk cli: ...........Receive......... .........Transmit.......... Count Lost Pct Jitter Count Lost Pct Jitter RTT.... Thanks, Michael
2023 Oct 14
2
Create new data frame with conditional sums
Well, here's one way to do it: (dat is your example data frame) Cutoff <- seq(0, .15, .01) Pop <- with(dat, sapply(Cutoff, \(p)sum(Totpop[Pct >= p]))) I think there must be a more efficient way to do it with cumsum(), though. Cheers, Bert On Sat, Oct 14, 2023 at 12:53?AM Jason Stout, M.D. <jason.stout at duke.edu> wrote: > > This seems like it should be simple but I
2023 Oct 14
1
Create new data frame with conditional sums
That's very helpful and instructive, thank you! Jason Stout, MD, MHS Box 102359-DUMC Durham, NC 27710 FAX 919-681-7494 ________________________________ From: John Fox <jfox at mcmaster.ca> Sent: Saturday, October 14, 2023 10:13 AM To: Jason Stout, M.D. <jason.stout at duke.edu> Cc: r-help at r-project.org <r-help at r-project.org> Subject: Re: [R] Create new data frame with
2007 Aug 23
2
read big text file into R
Dear Rs: Hi, I am trying to read a big text file (nrows=243440, ncols=144). It seems the computational time of all the read methods (scan,readtable,read.delim) is not linear to the number of rows I want to read in: things became really slow once I tried to read in 100000 lines compare to 10000 lines). If I am reading the profiling result right, I guess scan wouldn't help either. My
2012 Jun 09
3
More simple implementation is slow.
Hi all. I'm developing a function, which must return a square matrix. Here is the code: http://pastebin.com/THzEW9N7 These functions implement an analog of two embedded for cycles. The first variant creates the resulting matrix by columns, cbind()-ing them one by one. The second variant creates the matrix with two columns, which rows contain all possible variants of i and j and calls apply