similar to: how to use by() ?

Displaying 20 results from an estimated 600 matches similar to: "how to use by() ?"

2010 Nov 29
2
FW: how to use by() ?
Thank you for the suggestion, Bill. The result is not quite what I would like. Here's sample code for you or anyone else who may be interested: Al1 = c('A','C','C','C') Al2 = c('G','G','G','T') Freq1 = c(0.0078,0.0567,0.9434,0.9908) MAF = c(0.0078,0.0567,0.0566,0.0092) m1 = data.frame(Al1=Al1,
2009 Sep 18
1
Incorrect Dimension
I am new in R and i am having trouble here. I?ve already searched in the list but hasn?t helped When i run this script above i get the message "Error in gen[j, i] : incorrect number of dimensions". However gen is 1000x200 (ind x loc) and so is g could anybody help me for (i in 1 : loc) { #loc=200 for (j in 1 : ind) { #ind=1000 g1 <= function ( gen ) matrix ( if (gen[j, i]
2013 Apr 11
2
group data
Hey, I have a dataset and I want to identify the records by groups for further use in ggplot. Here is a sample data: ID Value AL1 1 AL2 2 CA1 3 CA4 4 I want to identify all the records that in the same state (AL1 AND A2), group them as "AL", and do the same for CA1 and CA4. How can I have an output like: ID Value State AL1 1 AL AL2 2 AL CA1 3 CA CA4 4
2008 Mar 07
3
Combine two columns
Is there a way to combine two columns within a data frame? Example data: id snp AL1 AL2 1500 30 A B 1510 30 A A 1520 30 A B This is what I would like: indv snp AL1AL2 1500 30 AB 1510 30 AA 1520 30 AB Any help is greatly appreciated. Alysta
2010 Dec 09
4
lapply getting names of the list
Hello All, I have a toy dataframe like this. It has 8 columns separated by tab. Name SampleID Al1 Al2 X Y R Th rs191191 A1 A B 0.999 0.09 0.78 0.090 abc928291 A1 B J 0.3838 0.3839 0.028 0.888 abcnab A1 H K 0.3939 0.939 0.3939 0.77 rx82922 B1 J K 0.3838 0.393
2010 Mar 09
3
Shade area under curve
I want to shade the area under the curve of the standard normal density. Specifically color to the left of -2 and on. How might i go about doing this? Thanks -- View this message in context: http://n4.nabble.com/Shade-area-under-curve-tp1586439p1586439.html Sent from the R help mailing list archive at Nabble.com.
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
Greetings: I would like comments on this example and after fixing it up, I need help from someone who has access to insert this in R's help page for plotmath. I uploaded a drawing http://pj.freefaculty.org/R/Normal-2009.pdf that is created by the following code http://pj.freefaculty.org/R/Normal1_2009_plotmathExample.R This will be a good addition to the plotmath help page/example.
2006 Mar 25
1
Trouble phrasing an R command that will run the model i need (ANOVA, nes
Hi John, Thank-you very much for replying, - in answer to your questions: *"As I understand what you wrote, all factors but linelabel are crossed, with linelabel nested within all the other factors?" That's exactly it, *" What is in the highest order cells? Single observations, or multiple scores?" I would say "single observations" - but i have to
2009 Sep 17
3
How to separate a function by 2 probabilities
Good Mourning, I have a function to generate a matrix as I show part of it; g[j,i]<-if (gen[j,i]==0) al1[i,1]+al1[i,1] else ... However i would like that this function occurred with a probability P and that another function (another formula to generate g matrix) with probability P-1 That?s it, if P is .7, i would like that in 70% of the times (for random i and j) the matrix g was generated
2009 Apr 17
1
cast function in package reshape
Hello R useRs, I have a function which returns a list of functions : freq1 <- function(x) { lev <- unique(x[!is.na(x)]) nlev <- length(lev) args <- alist(x=) if (nlev == 1) { body <- c("{", "sum(!is.na(x))", "}") f <- function() {} formals(f) <- as.pairlist(args) body(f) <- parse(text = body) namef <-
2008 Apr 23
3
select rows from data based on a vector of char strings
Hi, I have loaded a dataset in R : data = label freq1 freq2 news 54 35 fun 37 21 milk 19 7 food 3 3 .... etc And I have a vector flist<-c("fun","food") Now I want to use the vector 'flist' for selecting these values from 'data' so that I get the following dataset : label freq1 freq2 fun 37 21 food
2011 Nov 19
3
Data analysis: normal approximation for binomial
Dear R experts, I am trying to analyze data from an article, the data looks like this Patient Age Sex Aura preCSM preFreq preIntensity postFreq postIntensity postOutcome 1 47 F A 4 6 9 2 8 SD 2 40 F A/N 5 8 9 0 0 E 3 49 M N 5 8 9 2 6 SD 4 40 F A 5 3 10 0 0 E 5 42 F N 5 4 9 0 0 E 6 35 F N 5 8 9 12 7 NR 7 38 F A 5 NA 10 2 9 SD 8 44 M A 4 4 10 0 0 E 9 47 M A 4 5 8 2 7 SD 10 53 F A 5 3 10 0 0 E 11
2010 Mar 19
1
How to plot two cumulative frequency graph together
Dear masters, I have data that looks like this: #val Freq1 Freq2 0.000 178 202 0.001 4611 5300 0.002 99 112 0.003 26 30 0.004 17 20 0.005 15 20 0.006 11 14 0.007 11 13 0.008 13 13 ...many more lines.. Full data can be found here: http://dpaste.com/173536/plain/ What I intend to do is to have a cumulative graph with "val" as x-axis with "Freq1" & "Freq2" as
2011 Jan 14
2
read in data, maintain decimal places
Good day, All, Is there any way to maintain the number of decimal places in the type of situation below? I would like to maintain the number of decimal places in 0.667, despite the fact that its column-mates have a fourth decimal place. Thank you for your time. Jim dat.txt contents: MARKER ALLELES FREQ1 RSQR EFFECT2 STDERR CHISQ PVALUE rs6599753 C,T
2018 Mar 22
1
Calculate weighted proportions for several factors at once
Hi, I have a grouped data set and would like to calculate weighted proportions for a large number of factor variables within each group member. Rather than using dplyr::count() on each of these factors individually, the idea would be to do it for all factors at once. Does anyone know how this would work? Here is a reproducible example: ############################################################
2012 Feb 10
3
problem subsetting data frame with variable instead of constant
Hello, I've encountered a very weird issue with the method subset(), or maybe this is something I don't know about said method that when you're subsetting based on the columns of a data frame you can only use constants (0.1, 2.3, 2.2) instead of variables? Here's a look at my data frame called 'ea.cad.pwr': *>ea.ca.pwr[1:5,] MAF OR POWER 1 0.02 0.01 0.9999 2 0.02
2017 Nov 18
3
Complicated analysis for huge databases
The loop : AllMAFs <- list() for (i in length(SeparatedGroupsofmealsCombs) { AllMAFs[[i]] <- apply( SeparatedGroupsofmealsCombs[[i]], 2, function(x)maf( tabulate( x+1) )) } gives these errors (I tried this many times and I'm sure I copied it entirely) :- Error in apply(SeparatedGroupsofmealsCombs[[i]], 2, function(x) maf(tabulate(x + : object 'i' not found > }
2017 Nov 18
2
Complicated analysis for huge databases
Thanks Boris , this was very helpful but I'm struggling with the last part. 1) I combined the first 2 columns :- library(tidyr) SingleMealsCode <-unite(MyData, MealsCombinations, c(MealA, MealB), remove=FALSE) SingleMealsCode <- SingleMealsCode[,-2] 2) I separated this dataframe into different dataframes based on "MealsCombination" column so R will recognize each meal
2017 Nov 18
0
Complicated analysis for huge databases
> On Nov 18, 2017, at 1:52 AM, Allaisone 1 <allaisone1 at hotmail.com> wrote: > > Although the loop seems to be formulated correctly I wonder why > it gives me these errors : > > -object 'i' not found > - unexpected '}' in "}" You probably did not copy the entire code offered. But we cannot know since you did not "show your code",
2017 Nov 17
0
Complicated analysis for huge databases
Combine columns 1 and 2 into a column with a single ID like "33.55", "44.66" and use split() on these IDs to break up your dataset. Iterate over the list of data frames split() returns. B. > On Nov 17, 2017, at 12:59 PM, Allaisone 1 <allaisone1 at hotmail.com> wrote: > > > Hi all .., > > > I have a large dataset of around 600,000 rows and 600