similar to: Difficulties with dataframe filter using elements from an array created using a for loop or seq()

Displaying 20 results from an estimated 2000 matches similar to: "Difficulties with dataframe filter using elements from an array created using a for loop or seq()"

2006 Jul 01
0
SUMMARY: making contour plots using (x,y,z) data
Folks, A few days ago, I had asked a question on this mailing list about making a contour plot where a function z(x,y) is evaluated on a grid of (x,y) points, and the data structure at hand is a simple table of (x,y,z) points. As usual, R has wonderful resources (and subtle complexity) in doing this, and the gurus of the list showed me the way. Here's a complete working example. One might
2006 Jun 25
1
Puzzled with contour()
Folks, The contour() function wants x and y to be in increasing order. I have a situation where I have a grid in x and y, and associated z values, which looks like this: x y z [1,] 0.00 20 1.000 [2,] 0.00 30 1.000 [3,] 0.00 40 1.000 [4,] 0.00 50 1.000 [5,] 0.00 60 1.000 [6,] 0.00 70 1.000 [7,] 0.00 80 0.000 [8,] 0.00 90
2005 Nov 11
0
strange classification behaviour
You could use cut. The key calculation would be: w <- .05; eps <- 1e-5 breakpoints <- seq(min(kk), max(kk), .05) breakpoints <- floor( (breakpoints + (w/2) + eps) / w) * w values <- cut(kk, c(breakpoints, Inf), right = FALSE) values <- ordered(values) If you don't like the labels produced add lab = breakpoints as a cut arg. On 11/10/05, RenE J.V. Bertin
2009 Sep 16
3
apply function across two variables by mult factors
Greetings, I am attempting to run a function, which produces a vector and requires two input variables, across two nested factor levels. I can do this using by(X, list(factor1, factor2), function), however I haven't found a simple way to extract the list output into an organized vector form. I can do this using nested loops but it isn't exactly an optimal approach. Thank you
2010 Sep 18
0
Saving long character variable to database saves timestamp instead
When saving a data frame with long character variable, approximately longer than 30000 characters, to a text field in PostgreSQL, using RODBC on Windows XP, I get a timestamp saved to the database instead. Is there any way to extend the number of characters that a text variable can receive? Here are the details of my case (simplified): I'm using PostgreSQL to create a table CREATE TABLE
2013 May 27
1
Question about subsetting S4 object in ROCR
Dear list I'm testing a predictor and I produced nice performance plots with ROCR package utilizing the 3 standard command pred <- prediction(predictions, labels) perf <- performance(pred, measure = "tpr", x.measure = "fpr") plot(perf, col=rainbow(10)) The pred object and the perfo object are S4 with the following slots An object of class "performance"
2013 May 15
1
x and y lengths differ
I have a problem with R. I try to compute the confidence interval for my df. When I want to create the plot I have this problem: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ. I try this code: library(dplR) df.rwi <- detrend(rwl = df, method = "Spline",nyrs=NULL) write.table(df.rwi,file="rwi.txt",quote=FALSE,row.names=TRUE)
2007 Nov 20
2
as.character(seq(-.35,.95,.1))
> as.character(seq(-.25,.95,.1)) [1] "-0.25" "-0.15" "-0.05" "0.05" "0.15" "0.25" "0.35" "0.45" "0.55" "0.65" "0.75" "0.85" "0.95" > as.character(seq(-.35,.95,.1)) [1] "-0.35" "-0.25"
2012 Nov 13
0
GAM model to reduce PACF of a model
I have asked this question on Stackoverflow and was told it does not relate to the sites' mission as it is statistical question, thus I brought it here. I am fitting a gam mode in the mgcv package to study associations of environmental pollutants and mortality. The aim is to choose a model with lowest mgcv and also to reduce the PACF to less than < |0.1|. library(gamair) library(mgcv)
2009 Mar 20
4
how to make aggregation in R ?
Hi, I am trying to aggregate the sum of my test data.frame as follow: testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "c", "c", "c", "c", "c", "d", "d", "d", "d",
2011 Mar 09
2
SQLDF - Submitting Queries with R Objects as Columns
Fellow R programmers, I'd like to submit SQLDF statements with R objects as column names. For example, I want to assign "X" to "var1" (var1<-"X") and then refer to "var1" in the SQLDF statement. SQLDF needs to understand that when I reference "var1", it should look for "X" in the dataframe. This is necessary because my SQLDF
2009 Jul 21
1
problem with heatmap.2 in package gplots generating non-finite breaks
I have written a wrapper for heatmap.2 called heatmap.w.row.and.col.clust which auto-generates breaks using breaks<-round((c(seq(from=(-20 * stddev), to=(20 * stddev))))/20, digits = 2) #(stddev in this case = 2.5) This has always worked well in the past but now I am getting an error that non-finite breaks are being generated. Drilling down, it seems that my wrapper is generating finite
2008 Feb 26
1
wrapper for save function
Hello - I would like to create a wrapper to the 'save' function in the base package, but have a small problem with the name of the object that is getting saved in the file. Below is a simple example illustrating my problem. ## BEGIN SAMPLE R CODE ################################################## ## Here is the wrapper for the save function
2011 Sep 12
2
Automated generation of combinations
Hello,   I'd like to generate automatically all the possible combinations of a set of 8 variables (there are 535, too many to do it by hand). For example:   input: varA, varB, varC output: varA+varB+varC             varA+varB             varA+varC             varB+varC             varA             varB             varC Is there any function that produces this option?   Thank you [[alternative
2008 Mar 16
2
How to loop through all the columns in dataframe
Hi: Can anyone advice me on how to loop and perform a calculation through all the columns. here's my data xd<- c(2.2024,2.4216,1.4672,1.4817,1.4957,1.4431,1.5676) pd<- c(0.017046,0.018504,0.012157,0.012253,0.012348,0.011997,0.012825) td<- c(160524,163565,143973,111956,89677,95269,81558) mydf<-data.frame(xd,pd,td) trans<-t(mydf) trans I have these values that I need to
2011 Aug 03
1
Coefficient names when using lm() with contrasts
Dear R Users, Am using lm() with contrasts as below. If I skip the contrasts() statement, I get the coefficient names to be > names(results$coef) [1] "(Intercept)" "VarAcat" "VarArat" "VarB" which are much more meaningful than ones based on integers. Can anyone tell me how to get R to keep the coefficient names based on the factor levels
2005 Dec 13
1
Manipulating matrices
Hi, I'm pretty new to R and I've been having some problems filtering data in matrices. I have the following initial dataset: || year | name | varA || I have multiple values for "varA" for the same "year" and the same "name". Having this as the input I would like to obtain the following: || year | name | {varA mean} || Where I only have one line for each
2011 Jan 01
3
Retrieving Factors with Levels Ordered
Hello (and Happy New Year), When I create a factor with labels in the order I want, write the data as a text file, and then retrieve them, the factor levels are no longer in the proper order. Here is what I do (I tried many variations): # educ is a numeric vector with 1,001 observations. # There is one NA # Use educ to create a factor feducord <- factor(educ, labels = c('Elem',
2018 Apr 28
2
mp3 stream and Chrome v.65.0.33.25.181
Hi there, I have used VLC 0.9.9 on Windows platform for streaming audio to icecast2 for years. Had no problems. Since Google Chrome v.65.0.33.25.181 I ran into problems. Stream will play couple of minutes and then stop. Is there something fundamentally wrong with my configuration in vlm configuration: output
2007 Nov 07
2
creating a dynamic output vector
Let's say I have a program that returns variables whose names may be any string within the vector NAMES=c("varA","varB","varC","varD","varE","varF"..."varZ"), but I do not ever know which ones have actually been created. So in one example output, "varA", "varC", and "varD" could exist, but