Displaying 20 results from an estimated 10000 matches similar to: "my own function given to lapply"
2005 Aug 08
1
vector vs array
Hi!
OK, I'm trying to select some "useful outliers" from
my dataset: I defined 11 "treshold" values (1 for each
level of a variable (sampling site) as follows:
tresholds<-function(x)
{
tapply(x,mm$NAME,FUN=mean ,simplify = T, na.rm=T)->med
tapply(x,mm$NAME,FUN=sd ,simplify = T,
na.rm=T)->standev
standev+med
}
tresholds(mm$chl)
Now I'd like to select
2013 Mar 13
2
holding argument(s) fixed within lapply
|Hello,
Given a function with several arguments, I would like to perform an
lapply (or equivalent) while holding one or more arguments fixed to some
common value, and I would like to do it in as elegant a fashion as
possible, without resorting to wrapping a separate wrapper for the
function if possible. Moreover I would also like it to work in cases
where one or more arguments to the original
2006 Mar 30
3
access list component names with lapply
I have a question regarding accessing the names of list
components when applying a function with lapply.
Here is an example that demonstrates what I'd like to do.
I have a list like this one:
mylist <- list(a=letters[1:10], b=letters[10:1], c=letters[1:3])
Now I would like to append the names of the list components to their
corresponding vectors with the c() function. I thought this
2009 May 31
1
Bug in truncgof package?
Dear R-helpers,
I was testing the truncgof CRAN package, found something that looked
like a bug, and did my job: contacted the maintainer. But he did not
reply, so I am resending my query here.
I installed package truncgof and run the example for function ad.test. I
got the following output:
set.seed(123)
treshold <- 10
xc <- rlnorm(100, 2, 2) # complete sample
xt <- xc[xc >=
2011 Jan 15
3
get list element names within lapply / sapply call
Hi all,
I would like to iterate through a list with named elements and access the
names within an lapply / sapply call. One way to do this is iterate through
the names and index the list with the name. Is there a way to iterate
through the list elements themselves and access the element names within in
the function? For example,
mylist <-
2004 Feb 11
6
lapply and dynamically linked functions
Hi all,
I'm trying to use lapply on a list with the following command:
out<-lapply(mylist,myfun,par1=p,par2=d) (1)
where
myfun<-function(x,par1,par1) {.....} (2)
now this function is in fact a wrapper for some Fortran code I have
written so I think this might be the problem. When I call lapply() as in
(1) I get the following message:
Error in get(x,
2010 Mar 08
1
lapply and list indexing basics
I have split my original dataframe to generate a list of dataframes each of
which has 3 columns of factors and a 4th column of numeric data.
I would like to use lapply to apply the fitdistr() function to only the 4th
column (x$isi) of the dataframes in the list.
Is there a way to do this or am I misusing lapply?
As a second solution I tried splitting only the numeric data column to yield
a list
2016 Apr 05
0
Problem with <= (less than or equal): not giving the expected result
You could use something like this
x <- abs(0.95 - 1)
treshold <- 0.05
x < treshold | abs(x - treshold) < 1e-6
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
To call in the statistician after the experiment is
2004 Jun 04
1
rpart
Hello everyone,
I'm a newbie to R and to CART so I hope my questions don't seem too stupid.
1.)
My first question concerns the rpart() method. Which method does rpart use in
order to get the best split - entropy impurity, Bayes error (min. error) or Gini
index? Is there a way to make it use the entropy impurity?
The second and third question concern the output of the printcp() function.
2012 Nov 09
5
using lapply with recode
Hello:
Forgive me, this is surely a simple question but I can't figure it out, having consulted the help archives and "Data Manipulation With R" (Spector).
I have a list of 11 data frames with one common variable in each (prov). I'd like to use lapply to go through and recode one particular level of that common variable.
I can get the recode to work, but it only returns the
2004 Apr 20
2
polygon
Dear all
In order to clearly mark values wich are larger than a treshold value, I
would like to color the surface below the line given by plot (yy~xx). To
color is only the surface between abline (treshold) and yy if they are
larger than the specific limit. I guess I can use the function polygon,
but I can not find any valuable solution.
I'm grateful to you for an advice or an example.
2003 Sep 26
2
overlay two pixmap
Hi
I need to overlay two pixmaps (library (pixmap)). One, a pixmapGrey, is
the basis, and on this I need to overlay a pixmapIndexed, BUT: the
pixmapIndexed has set only some of its "pixels" to an indexed color,
many of its pixels should not cover the basis pixmapGrey pixel, means,
for this "in pixmapIndexed not defined pixels" it should be transparent.
What would you
2010 Mar 08
1
lapply and list indexing basics (after realizing I wasn't previously subscribed...sorry)
I have split my original dataframe to generate a list of dataframes each of
which has 3 columns of factors and a 4th column of numeric data.
I would like to use lapply to apply the fitdistr() function to only the 4th
column (x$isi) of the dataframes in the list.
Is there a way to do this or am I misusing lapply?
As a second solution I tried splitting only the numeric data column to yield
a
2008 Nov 13
1
Calculate Specificity and Sensitivity for a given threshold value
Hi list,
I'm new to R and I'm currently using ROCR package.
Data in input look like this:
DIAGNOSIS SCORE
1 0.387945
1 0.50405
1 0.435667
1 0.358057
1 0.583512
1 0.387945
1 0.531795
1 0.527148
0 0.526397
0 0.372935
1 0.861097
And I run the following simple code:
d <- read.table("inputFile", header=TRUE);
pred <- prediction(d$SCORE, d$DIAGNOSIS);
perf <- performance(
2008 Sep 12
5
cram-md5 and users maintaining their own passwords?
Is there any other mechanism than using passwd files with md5-hashed
passwords created by dovecotpw that will support cram-md5
authentication?
Has anyone created setups where the passwd databases reside in the
individual users home directories?
Is it possible to persuade dovecotpw to update the passwd databases
automatically. Having to use a text editor to paste in the passwords
sets a high
2016 Apr 05
1
Problem with <= (less than or equal): not giving the expected result
Thanks!
On 05 Apr 2016, at 16:07, Thierry Onkelinx <thierry.onkelinx at inbo.be<mailto:thierry.onkelinx at inbo.be>> wrote:
You could use something like this
x <- abs(0.95 - 1)
treshold <- 0.05
x < treshold | abs(x - treshold) < 1e-6
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie &
2004 Oct 11
1
Linux freezes on large file transfers
I am running MD 10 (Community) as a file server on a Shuttle SB61G2. This
setup worked very well under Mandrake 9.2 however, everytime I try to copy
files larger than say <550 ~650MB using MD 10, my linux box freezes and must
be rebooted. I can FTP the same file(s) perfectly fine to other PC 's on my
home net. Small volumes of files work fine as well as ISO images, the box
seems to
2011 Jan 17
1
Importing multiple text files with lapply.
Hello,
I'm trying to read in 50 text filess with dates as content to create a list of tables.
a is the list of filenames that need to be read in.
The following command returns the following error
mylist<-lapply(a, read.table(header=TRUE, sep="\n"))
Error in read.table(header = TRUE, sep = "\n") :
element 1 is empty;
the part of the args list of
2015 May 04
2
Define replacement functions
Hello
I tried to define replacement functions for the class "mylist". When I test them in an active R session, they work -- however, when I put them into a package, they don't. Why and how to fix?
make_my_list <- function( x, y ) {
return(structure(list(x, y, class="mylist")))
}
mylist <- make_my_list(1:4, letters[3:7])
mylist
mylist[['x']] <- 4:6
2009 Aug 12
1
calling a function with dynamically generated buttons
Hallo,
I'm dynamically generating buttons depending on the number of rows of
my dataframe. Every button is supposed to call a function which
generates a plot with the values of one of my dataframe rows.
My code looks like this:
base <- tktoplevel()
plotten <- function(mat, namen, titel) {
midpts <- barplot(height=mat, names.arg = namen, main =
titel, las=2)