search for: xout

Displaying 20 results from an estimated 97 matches for "xout".

Did you mean: out
2009 Dec 01
3
paste name in for loop?
Hello, I am trying to create subsets of grouped data (by area size), and use the area size as part of the output name. The code below works for area (xout) 1 and 50, the other files are given NA for an area. A simple example: xout <- c(1,5,10,25,50,100) for(i in xout) { print(paste("Areal_Ppt_",xout[i],"sqmi.txt", sep="")) } [1] "Areal_Ppt_1sqmi.txt" [1] "Areal_Ppt_50sqmi.txt" [1] "Areal_Ppt_...
2015 Jun 30
3
Loop for: mostrar el nombre de la variables
...ED=(rnorm(10)+2.5)*20) # Función DES: DES = function(XDADES) { attach(XDADES) for (XVARNUM in XDADES) { if(is.numeric(XVARNUM)) { print (c("Var Num: ", mean(XVARNUM))) } else if(is.factor(XVARNUM)) { print (c("Var factor: ")) XOUT <- as.data.frame(table(XVARNUM)) print(XOUT <- transform(XOUT, cumFreq = cumsum(Freq), relative = prop.table(Freq))) } else { print ("Var desc") } } detach(XDADES) } DES(XDADES=TBL) *************************** Tengo dos problemas: 1. En: print (c...
2009 Jul 21
1
bug in approx crashes R
Dear R-devel, The following line crashes R > approx(1, 1, 0, method='const', rule=2, f=0, yleft=NULL, ties='ordered')$y Process R:2 exited abnormally with code 5 at Tue Jul 21 14:18:09 2009 > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 9.1 year
2012 Jun 06
2
package zoo, function na.spline with option maxgap -> Error: attempt to apply non-function?
Hello, I'm trying to use na.spline (package zoo) to fill some missing data in a time series. this works fine, however, if I apply the 'maxgap' argument, I always get the error: <------ Error in na.spline.vec(x., coredata(object.), xout = xout., ...) : attempt to apply non-function ------> I couldn't find a similar error for this case in the mailing lists and zoo vignette, I hope I didn't miss any basic thing, but as I don't know how to proceed, any help on why this isn't working is very much appreciated (I g...
2006 Jul 17
3
information about a function
...ould not find a FAQ for it in particular, furthermore I could not find my question answered in the official R FAQ or docs. I have simply something like this: > f<-approxfun(data[,1],data[,2]) and f is: > f function (v) .C("R_approx", as.double(x), as.double(y), as.integer(n), xout = as.double(v), as.integer(length(v)), as.integer(method), as.double(yleft), as.double(yright), as.double(f), NAOK = TRUE, PACKAGE = "base")$xout <environment: 02106C24> I also used "locPoly". Both yield either a function or a data frame of values. Is there a wa...
2011 Sep 09
2
Subset function
Hi, can anyone help me how to use 'subset' function on my data frame? I have created data frame 'data' with a few variables and with row names. Now I would like to subset rows with concrete row names. Using data[] I know how to do it. But I dont know how to formulate the subset condition: subset(data, subset = ?, select = c(var1, var2)) Thank you very much, stat.kk -- View this
2011 Mar 24
1
fraction with timelag
Dear r-help, I'm having this DF df <- data.frame(id = 1:6, xout = c(1234, 2134, 234, 456, 324, 345), xin= c(NA, 34,67,87,34, NA)) and would like to calculate the fraction (xin_t / xout_t-1) The result should be: # NA, 2.76, 3.14, 37.18, 7.46, NA I am sure there is a solution using zoo... but I don't know how... Thanks for any help! Patr...
2011 Oct 20
0
Apply approx() to an array and eventually a list of arrays
....dim) test.arr.filled<-array(NA,dim=arr.dim) test.arr[9:13,1,1]<-NA #create some data gaps ### I can only get approx() to work if I loop through third dimension of the array for(i in 1:dim(test.arr)[3]){ test.mat<-test.arr[,,i] linear.interp.list<-apply(test.mat,MARGIN=2,FUN=approx,xout=1:nrow(test. mat),x=1:nrow(test.mat)) test.arr.filled[,,i]<-matrix( sapply(linear.interp.list,'[[','y'),ncol=ncol(test.mat),byrow=FALSE) } #### How to use approx() on array? # this clearly doesn't work apply(test.arr,MARGIN=2,FUN=approx,xout=1:nrow(test.arr),x=1:nrow(test...
2013 Jan 16
1
function approx interpolation of time series data sets
...data1: 01:23:40 5 01:23:45 10 01:23:50 12 01:23:55 7 data2: 01:23:42 01:23:47 01:23:51 01:23:54 The objective is to obtain interpolated values of 'data1' column 2 (5, 10, 12, 7) for the times shown in data2. Tried the following command but received the error shown: data3<-approx(data1,xout=data2) Error in approx(data1, xout = data2) : (list) object cannot be coerced to type 'double' What is my mistake please? -- r2151
2019 May 10
0
[R] approx with NAs --> new argument 'na.rm=TRUE' ?!
...e which automatically was using 'rule' to determine these results. The help file contains nice examples. Here are some of its results --- comments are very welcome -- > ### Treatment of 'NA's -- are kept if na.rm=FALSE : > > xn <- 1:4 > yn <- c(1,NA,3:4) > xout <- (1:9)/2 > ## Default behavior (na.rm = TRUE): NA's omitted; extrapolation gives NA > data.frame(approx(xn,yn, xout)) x y 1 0.5 NA 2 1.0 1.0 3 1.5 1.5 4 2.0 2.0 5 2.5 2.5 6 3.0 3.0 7 3.5 3.5 8 4.0 4.0 9 4.5 NA > data.frame(approx(xn,yn, xout, rule = 2))# -> *constant* e...
2004 Aug 16
3
bus error /segmentation fault from 'approx' (PR#7177)
Full_Name: joerg van den hoff Version: 1.9.1 OS: MacOS and SunOS Submission from: (NULL) (149.220.4.88) follow up to ID 7166. something like approx(c(1,2),c(NA,NA),1.5,rule=2) crashes 1.9.1 on both systems (MacOS 10.3.5.: bus error, SunOS 5.9: segmentation fault) even if xout is within given x range (as in example above) where rule=2 seems not be relevant anyway.
2013 Feb 26
2
Help on a code
Dear List,   I have the following code:   x <-c(0, 13.8333333333333, 38.1666666666667, 62.1666666666667, 85.9166666666667, 108.916666666667) y <-c(1.77, 2.39, 3, 2.65, 2.62, 1.8) Interpolated <- approx(x, y,xout=0:tail(x, n=1),method="linear") plot(Interpolated)   in this code x is time in hours (cumulative), and y is a biological variable. I am using linear interpolation assuming getting from y(i) to y(i+1) is a linear path. I would like to calculate the time in this case that it takes to surpas...
2008 Sep 01
2
Interpolation Problems
Dear all, I'm trying to interpolate a dataset to give it twice as many values (I'm giving the dataset a finer resolution by interpolating from 1 degree to 0.5 degrees) to match that of a corresponding dataset. I have the data in both a data frame format (longitude column header values along the top with latitude row header values down the side) or column format (in the format latitude,
2007 Aug 31
0
FW: sapply to return factors in dataframe
...he previous code. Updated and functional version follows after my initial question: I am trying to randomise a dataframe with mixed factors/numeric variables and return a new (randomised) dataframe with the same columns (as factors/numeric). simgap<-function(x) { ma<-max(x) mi<-min(x) Xout<-runif(length(x),min=mi,max=ma) return(Xout) } rdize.dta<-function(x){ if(is.factor(x)) { cat(str(x),"\n") factor(as.character(round(runif(n=length(x),min=1,max=nlevels(x)),0)))} else if(is.integer(x)) round(simgap(x),0)...
2009 Mar 06
0
impcat='tree'
...ranscan(~sz+sg+ap+sbp+dbp+age+wt+hg+ekg+pf+bm+hx,imputed=TRUE,data=prostate,impcat='tree') However I get the following error message(s) Convergence criterion:1.511 0.787 0.41 0.215 0.115 0.062 Error: could not find function "tree" In addition: Warning messages: 1: In approx(y, x, xout = aty, rule = rule) : collapsing to unique 'x' values 2: In approx(y, x, xout = aty, rule = rule) : collapsing to unique 'x' values 3: In approx(y, x, xout = aty, rule = rule) : collapsing to unique 'x' values 4: In approx(y, x, xout = aty, rule = rule) : collapsing...
2009 Mar 25
1
Interpolate x from y
Is it possible to interpolate a value for x with knowledge of y? For example, approx(x, y, xout) will give me y's given a set of x's, which is opposite to what I'm after. I've tried switching x and y, e.g., approx(y, x, xout), but in a real data set it is possible to have more than one y for a given x causing approx() to remove coordinates. Thanks for your help, Greg.
2011 May 04
1
bivariate linear interpolation
Hi, I have three matrices (X,Y,P) with the same dimension. The X,Y grid is regular and I want to perform linear interpolation to pick out certain points. In matlab appropriate call is something like Pout=interp2(X,Y,P,Xout,Yout, method="linear") where Xout and Yout are the locations where I want the Pout data (typically a different grid). (Scipy has this routine in interpolate.interp2d, with similar arguments) In R there is (as often) the choice between many different interpolation routines. Akima has on...
2015 Jul 14
4
Conservar el nombre de la variable entre varias funciones: ejemplos de resultados
...") return(summary(get(X))) } ##-------------------------------------------------------------- ## DES_QUALI: Descriptiva variables factor ##-------------------------------------------------------------- DES_QUALI <- function(X) { cat("Var factor: ",X,"\n") XOUT <- as.data.frame(table(get(X))) names(XOUT)[1] = X XOUT <- transform(XOUT, cumFreq = cumsum(Freq), Percentatge = prop.table(Freq)) print(XOUT) print("-----------------------------------------------------") } ##--------------------------------------------------------------...
2013 Feb 14
1
approxfun values
...interpolation V1 V2 1 10 2 2 20 NA 3 30 5 4 40 7 5 50 NA 6 60 NA 7 70 2 8 80 6 9 90 9 10 100 NA > testinterpolationvalues<-approxfun(testinterpolation,y=NULL) > testinterpolationvalues function (v) .C(C_R_approxfun, as.double(x), as.double(y), as.integer(n), xout = as.double(v), as.integer(length(v)), as.integer(method), as.double(yleft), as.double(yright), as.double(f), NAOK = TRUE, PACKAGE = "stats")$xout <bytecode: 0x33ffab84> <environment: 0x34072eac> > testinterpolationvalues<-approx(testinterpolation,y=NULL) > te...
2011 Feb 25
1
Error: address 0x6951c20, cause 'memory not mapped'
Dear R list, I get a strange error in R: *** caught segfault *** address 0x6951c20, cause 'memory not mapped' Traceback: 1: .C("spline_eval", z$method, nu = as.integer(n), x = as.double(xout), y = double(n), z$n, z$x, z$y, z$b, z$c, z$d, PACKAGE = "stats") 2: spline(gam.data$x[, col.data], gam.smooths.all$fit[, m], xout = gam.results.global[m, , "x.values"], ties = mean) 3: eval.with.vis(expr, envir, enclos) 4: eval.with.vis(ei, envir) 5: source(file.pat...