similar to: Help with if statements

Displaying 20 results from an estimated 12000 matches similar to: "Help with if statements"

2011 Jul 19
1
list.files recursively to find files in a specific way...
Hi, all: My folders are organized in such a way: root ----branch1 ---------------A -----------------------file1.txt -----------------------file2.txt ---------------B -----------------------file1.txt -----------------------file2.txt ----branch2 ---------------A -----------------------file1.txt -----------------------file2.txt ---------------B -----------------------file1.txt
2010 Dec 20
2
For-loop
Hi, I have the following problem: I have a data.frame with 36 sample sites (colums) for which I have covariates in 3 categories: Area, Month and River. Each Area consists of 3 rivers, which were sampled over 3 month. Now I want to fuse River 1-3 for one area in one month. To get a data.frame with 12 colums. I am trying to do a "for loop" (which may be a complicated solution, but I
2010 Jul 06
2
Help With ANOVA
Hi I needed some help with ANOVA I have a problem with My ANOVA analysis. I have a dataset with a known ANOVA p-value, however I can not seem to re-create it in R. I have created a list (zzzanova) which contains 1)Intensity Values 2)Group Number (6 Different Groups) 3)Sample Number (54 different samples) this is created by the script in Appendix 1 I then conduct ANOVA with the command >
2008 Sep 16
4
HI
Does anyone know an easy way to convert all the zero values in a imported csv table into NA's [[alternative HTML version deleted]]
2007 May 14
6
Conditional Sums for Index creation
Hi, Apologies for the long mail. I have a data.frame with columns of price/mcap data for a portfolio of stocks, and the date. To get the total value of the portfolio on a daily basis, I calculate rowSums of the data.frame. > set.seed(1) > ab <- matrix(round(runif(100)*100),nrow=20,ncol=5) > ab[1:5,4:5] <- NA > ab[6:10,5] <- NA > ac <- as.data.frame(ifelse(ab <=
2009 May 15
1
Fw: Help with loops(corrected question)
--- On Fri, 15/5/09, Amit Patel <amitrhelp at yahoo.co.uk> wrote: > From: Amit Patel <amitrhelp at yahoo.co.uk> > Subject: Help with loops > To: r-help at r-project.org > Date: Friday, 15 May, 2009, 12:17 PM > Hi > I am trying to create a loop which averages replicates in > my data. > The original data has many rows. and consists of 40 column > zz[,2:41]
2010 Jul 06
3
Help With ANOVA (corrected please ignore last email)
Sorry i had a misprint in the appendix code in the last email Hi I needed some help with ANOVA I have a problem with My ANOVA analysis. I have a dataset with a known ANOVA p-value, however I can not seem to re-create it in R. I have created a list (zzzanova) which contains 1)Intensity Values 2)Group Number (6 Different Groups) 3)Sample Number (54 different samples) this is created by the
2010 Sep 07
3
Help with decimal points
Hi I have found a little problem with an R script. I am trying to merge some data and am finding something unusual going on. As shown below I am trying to assign (MatchedValues[Value2,Value]) to (ClusteredData[k,Value]) which are two separate dataframes. 1) By the following command you can see that the value im transferring is 481844.03 > MatchedValues[Value2,Value] [1] 481844.03 6618
2010 May 13
3
Help with Loops
Hi I have tried many attempts but cant get the loop right, as I am not a strong programmer. What I am basically trying to do is compare 2 spreadsheets. The problem is that one of them only contain a portion of the overall data (TESTSAMP), where the other has a full datasetFULLSAMP. From the complete set I would like to remove the rows of data which are not in the TESTSAMP. Column 1 contains the
2010 Aug 12
3
Error in rowSums
Hi I am trying to calculate the row sums of a matrix i have created The matrix ( FeaturePresenceMatrix) has been created by 1) Read csv 2) Removing unnecesarry data using [-1:4,] command 3) replacing all the NA values with as.numeric(0) and all others with as.numeric (1) When I carry out the command TotalFeature <- rowrowSums(FeaturePresenceMatrix, na.rm = TRUE) I get the following
2010 Oct 04
1
adding a legend to the plot (but outside of it)
Hello! My code below creates a data frame and a plot for it. However, I can't figure out how to add a legend that is not ON the plot itself, but outside of it (e.g., to the right of my graph or below it). I tried something: I put a line par(xpd=T, mar=par()$mar+c(0,0,0,4)) right before my plot command), but that screwed up all my gridlines - they covered all graph and do not coincide with
2010 Oct 04
1
reducing distances between tickmarks
Hello, everybody! I have a code below that creates a data set and then a stacked bar chart based on that data set. No need to look at it - just notice please that my horizontal axis is a date varible (x=my.data$date). I have a question about the last 2 lines of this code: grid(nx=NULL,ny=NULL,col = "lightgray", lty = "dotted",lwd = par("lwd")) axis(1, las = 2) Could
2010 Aug 13
2
Fw: Error in rowSums REPOST
For the query below I have also included the follwing information. Thanks for your replies > str(FeaturePresenceMatrix) chr [1:65530, 1:40] "0" "0" "0" "0" "1" "0" "0" "0" "0" ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:65530] "4" "5" "6" "7" ...
2010 Sep 27
1
stacked area chart
Dear R-ers! Asking for your help with building the stacked area chart for the following simple data (several variables - with date on the X axis): ### Creating a data set my.data<-data.frame(date=c(20080301,20080402,20080503,20090301,20090402,20090503,20100301,20100402,20100503), x=c(1.1,1.0,1.6,1,2,1.5,2.1,1.3,1.9),y=c(-4,-3,-6,-5,-7,-5.2,-6,-4,-4.9),
2009 Sep 26
3
Adding variables
Hi, For very large matrices, is this the most efficient way to add two variables together? ############################# attach(attenu) new<-rowSums(cbind(mag, station)) ############################# Also, could I be directed to some resources for working with very large datasets? Thanks
2010 Mar 03
1
Help with multtest (rawp2adjp)
Hello R experts, I am trying to analyze this dataset and am stuck on this problem for quite some time now. I am using mt.rawp2adjp. the output that came out was a matrix with two colums since I had asked it to calculate the adjusted p values using one method. so it has the two columns as: rawp BH I combined these using cbind with my actual dataframe. checked using head all was fine. thereafter I
2010 Oct 05
2
is there a way to avoid "traveling" grid?
Hello! If you run the whole code below, it'll produce a stacked diagram. And it looks good - because the tick-marks are aligned with the grid. However, if I stretch the graph window, grid becomes misaligned with the tickmarks. Or, rather, it seems aligned for the first and the last tick mark, but not for tickmarks in between. Can it be addressed? Thank you! Dimitri ### Creating a data set
2009 Jun 08
2
help to speed up loops in r
Hi i am using a script which involves the following loop. It attempts to reduce a data frame(zz) of 95000 * 41 down to a data frame (averagedreplicates) of 95000 * 21 by averaging the replicate values as you can see in the script below. This script however is very slow (2days). Any suggestions to speed it up. NB I have also tried using rowMeans rather than adding the 2 values and dividing by 2.
2010 Sep 06
2
Help with unexpected symbol errors
Hi I have got a long script which will not run for me as i keep getting errors : > source("clusterfixV1_4.r") Error in source("clusterfixV1_4.r") : clusterfixV1_4.r: unexpected symbol at 158: eck[k,2] <- as.numeric(1) 159: #ClusterInfo[k,2] <- "Clustered I have sorted all the ones i can but i am having a problem here Can anyone tell me the
2007 Oct 23
3
sum variable as long condition is true
Hello R For expierienced user, the following problem will be easy to solve: a<-c(0,1,0,1,0,2,3,4,3,2) b<-c(3,3,3,4,4,4,7,7,7,10) c<-data.frame(a,b) Data Frame c contains tow colums. I would like to sum up all values in a as long as b stays the same: sum(a[which(b==1)]) does this, but i have to manually put in b then i tryied st like this, but i canno't save it properly for (i