similar to: inline function in apply

Displaying 20 results from an estimated 80000 matches similar to: "inline function in apply"

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,
2006 Mar 10
1
what's wrong with my "cov"?
Hi all, Why cov(y, y) only gives one value, and cov(t(y), t(y)) gives 3x3 NA matrix? Here my y is listed below and it is a 3x1 matrix. I am expecting that if I have a random vector y=[y1 y2 y3]', here " ' " denotes a transposition so that y is a column vector, where y1, y2, y3 are independent random variables... then cov(y, y) should be E[ y * y' ] - E[y] * E[y] ',
2010 Mar 18
2
how to take multiple subsets from a matrix
useR's I have a matrix from which I want to take multiple subsets from, according to a particular scheme I will now describe. The matrix below (mat) is 5x5, and I want to take 9 subsets of it, each of dimension 3x3. The best way to explain what the result should look like is with the following: > dat <- c(3,6,1,9,12,9,2,10,6,5,3,13,1,4,8,9,4,6,10,11,2,7,3,5,10) > miss <-
2009 Aug 26
1
Filtering matrices
I'm using the rcorr function from the Hmisc library to get pair-wise correlations from a set of observations for a set of attributes. This returns 3 matrices; one of correlations, one of the number of observations seen for each pair and the final of the P values for each correlation seen. >From these three matrices, all I wish to do is return a single matrix based on the first correlation
2012 Jun 04
2
how to ignore NA with "NA" or "NULL"
Hello dear R-users, I have a problem in my code about ignoring NA values without removing them. I'm working on a list of files. The aim is to fill one file from another according to the highest correlation (correlation coeff between all my files, so the file which looks like the most to the one I want to fill). When I have just small gaps of NA, my function works well. The problem is when I
2012 Oct 18
1
filling NA gaps according to previous data mean and following data mean
Hi everybody, I have a little problem about filling some gaps of NAs in my data. These gaps are between nearly constant data (temperature under snow). Here's a fake example to illustrate how it looks like approximately: DF <- data.frame(data=c(-0.51,-0.51,-0.48,-0.6,-0.54,-0.38,-0.6,-0.42,NA,NA,NA,NA,NA,NA,NA, -0.25,-0.41,-0.5,-0.5,-0.35,-0.7,-1,-0.87)) I would like to replace my NAs
2009 Jul 21
2
Show representation of a data structure
I'm currently working with some large complex data structures eg list of lists of data_frames containing lots more variables and lists etc. Sometimes, I'd like to be able to bring up a simple representation of the structure I'm working with, minus all of the values it contains (so simply printing the variable doesn't work as its too hard to see structure when there are 1000s of
2009 Jan 21
3
filling blanks with NA
Hi, I do have a data set with some missing values that appear as blanks. I want to fill these blanks with an NA. How can this be done? Thanks for your help -- View this message in context: http://www.nabble.com/filling-blanks-with-NA-tp21584278p21584278.html Sent from the R help mailing list archive at Nabble.com.
2009 Mar 26
2
Tables
Hi, I am just starting using R. Hence, sorry for asking probably rather easy questions. I used "read.table" to bring an .txt Table to R. Unfortunately the columns do not have the same length. I tried "fill=TRUE", to fill the blank space with "na". In a certain kind of way it worked, but befor filling the spaces it moved data from later columns to the first: 1
2013 May 03
2
how to parallelize 'apply' across multiple cores on a Mac
Hi everyone, I'm trying to use apply (with a call to zoo's rollapply within) on the columns of a 1.5Kx165K matrix, and I'd like to make use of the other cores on my machine to speed it up. (And hopefully also leave more memory free: I find that after I create a big object like this, I have to save my workspace and then close and reopen R to be able to recover memory tied up by R, but
2007 May 03
3
Filling array: No recycling
Hello, is it possible to fill an array with no using of the recycling rule? My problem. I want to fill an array but my values have not always the same length. My aim. I want to fill the array only ONE TIME. All vacent places should be written with NA. Thank's a lot. Felix Example: -------- #Write 1 to 3 only one time. The last #5 place should be NA. dim(as.array(letters)) array(1:3,
2006 Sep 07
1
area between two curves, but one is not continuous
Hello, I want to colorize the area between two curves, but one of these curves isn't continuous. The best solution I found is the 2nd example in the help of polygon, but how can I get no area filling for the missing data in the 2nd curve. example: x1 = c(1:8) x2 = c(1:8) y1 = c(1,5,6,1,4,5,5,5) y2 = c(0,3,3,NA,NA,1,3,4) plot(x1,y1,type="l") lines(x2,y2) for the missing parts I
2011 Apr 28
1
AutomaticTRUE/FALSE Matrix Generation
Dear All, I am a newbee in R an have the following problem. I have variables AB,BC,CD to which outputs are assigned. Now AB[,1], for example, outputs a list, which is a random combination of the following characters: "AB", "BC", "CD". What I want to do is to build a 3x3 matrix with colnames and rownames equal to "AB", "BC", "CD". Matrix
2005 Oct 29
1
how to get colnames of a dataframe within a function called by 'apply'
Hello alltogether, how is it possible to assign the colnames of a data.frame to a function called by apply, e.g. for labeling a plot? Example: I want to plot several qqnorm-plots side by side and there should be a maintitle for each qqnorm-plot which is identical to the respective colname. I checked, but the column which is processed by the function called by apply does not contain a colname
2012 Apr 03
3
filling small gaps of N/A
Hi everybody, I'm a new R french user. Sorry if my english is not perfect. Hope you'll understand my problem ;) I have to work on temperature data (35000 lines in one file) containing some missing data (N/A). Sometimes I have only 2 or 3 N/A following each other, but I have also sometimes 100 or 200 N/A following each other. Here's an example of my data, when I have only small gaps
2009 Jun 17
3
Problem in 'Apply' function: does anybody have other solution
Dear All, I am having some problem in apply function. I have some data like below. I want to get a range vector (which is max-min value for each row , ignoring NA values.) > Species.all[1:10,] V2 V3 V4 V5 V6 V7 V8 V9 1 57543 55938 47175 54922 36032 5785 29497 7286 2 42364 40472 29887 40107 19723 2691 14445 3258 3 19461 19646 18538 22392 6744 794
2008 Aug 27
1
ifelse() fill order and recycling rules [Sec=Unclassified]
Hi all, Using R v2.7.1, platform i386-pc-mingw32 Can someone please shed some light on the behaviour of ifelse() for me? My intent is to calc relative proportions of z$b, at the same time subsetting z$b based on z$a. I could attack the problem other ways (suggestions welcome) but I am also intrigued by the _order_ in which ifelse seems to assign values, and how recycling works. For instance,
2012 May 03
2
add an automatized linear regression in a function
Dear R users, For the moment, I have a script and a function which calculates correlation matrices between all my data files. Then, it chooses the best correlation for each data and take it in order to fill missing data in the analysed file (so the data from the best correlation file is put automatically into the missing data gaps of the first file (because my files are containing missing values
2006 Jul 31
2
if function and apply
Runninn R.2.3.1 Windows XP I have a dataset just imported from SPSS. It has any number of 99's as missing data and it looks like the next dataset will have custom missing codes. I have abouat 120 variables and an N of 2000. "I think" thatI would like to apply a function to the data.frame (or to a matrix of the data if needed) to recode all the 99's to NA. I thought that I
2018 Mar 15
3
stats 'dist' euclidean distance calculation
Hello, I am working with a matrix of multilocus genotypes for ~180 individual snail samples, with substantial missing data. I am trying to calculate the pairwise genetic distance between individuals using the stats package 'dist' function, using euclidean distance. I took a subset of this dataset (3 samples x 3 loci) to test how euclidean distance is calculated: 3x3 subset used