Giovanni,
You can use the '...' for that, as in:
loocv <- function(data, fnc, ...) {
n <- length(data.x)
score <- 0
for (i in 1:n) {
x_i <- data.x[-i]
y_i <- data.y[-i]
yhat <- fnc(x=x_i,y=y_i, ...)
score <- score + (y_i - yhat)^2
}
score <- score/n
return(score)
}
scoreks <- l
Hello!
I'm a college undergrad desperately trying to finish up my thesis. I
have a dataset on the distribution of a grassland bird from the
Breeding Bird Survey. I have a very straightforward and simple version
of the logistic growth model to describe changes in this bird's
abundance over time. Th
What causes the error report:
logical(0)
to arise in the rms function lrm?
Here's my data:
But both the dependent and the independent variable seem fine...
> str(AABB)
'data.frame':1176425 obs. of 9 variables:
$ sex : int 1 1 0 1 1 0 0 0 0 0 ...
$ faint : int 0 0 0 0 0 0 0 0 0 0
Having some difficulties with understanding how tapply works and getting
return values I expect
Data: dataframe. DF DF$Id $D $Year...
Id D Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct
Nov Dec
11264402000 1 1980 NA NA NA NA NA 212 203 209 228 237 NA
Hi, Dear R community,
Does anyone know how to constructdecision tree with boosting? Is any
tutorial I can read?
--
Sincerely,
Changbin
--
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman
Hi,
I found my mistake after a week and yeah the above code by Mario works. I
apologize for my previous post which says that it does not work. It was my
fault as I made a blunder. Thanks a lot for the same.
I am trying to redirect my output generated through my R script in the shell
script by usi
I am trying to get summary statistics from WinBUGS/JAGS output in the
form of mcmc.list objects, using the summary() function. However, I
get odd warning messages:
Warning messages:
1: In glm.fit(x = X, y = Y, weights = weights, start = start, etastart
= etastart, :
algorithm did not converge
2
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Tal Galili
> Sent: Sunday, April 25, 2010 9:40 AM
> To: r-help@r-project.org
> Subject: [R] Upgrading R using the "global library folder" strategy - what
> do you think about it?
>
(I thought I was posting in another thread that would have made it
obvious what I was talking about. Thanks for replying!)
I don't think this this is a random test, since the error is reproducible
the same way every time. The attached archive has some relevent files,
including config output and
On Apr 25, 2010, at 11:30 PM, robert lee wrote:
Wanted to thank David and Jim for the str. The x and y were
created using the function below. In one case, reshape1 returned
list and other data frame. I put the fix by putting the
as.data.frame below
I hope you are making progress on
Wanted to thank David and Jim for the str. The x and y were created using the
function below. In one case, reshape1 returned list and other data frame. I
put the fix by putting the as.data.frame below
myPivot <- function(y,x,z,m, ...){
m1 <- m[c(x,y,z)] # select the the columns wanted
I went to this site --- half of the questions are about "how much do
you want to pay for training courses"
Kjetil
On Sun, Apr 25, 2010 at 5:25 PM, Tal Galili wrote:
> Maybe I missed something - but *why* should we do it?
>
>
> Contact
> Details:---
On Apr 25, 2010, at 10:15 PM, robert lee wrote:
I have two data frames ( x and y -- sample values below). The rows
have HH:MM:SS and columns have names of devices.
I am trying to find a list of 5 least used devices during recorded
time period. When apply function is used to sum on the co
If you are saving it to read back into R, then consider using 'save' and
'load'. It will avoid any problems that you might have when converting back
and forth from the internal format to ascii data in a flat file.
Also since you posted no data, there is no way we can help you solve the
problem.
I have two data frames ( x and y -- sample values below). The rows have
HH:MM:SS and columns have names of devices.
I am trying to find a list of 5 least used devices during recorded time period.
When apply function is used to sum on the column, I get the correct answer on
data frame called x
Hi all folks,
I would like to know if somebody has a PDF text with the first steps
to use maps in R, like: insert maps, open maps, create adjacency
matrix, make the moran index, etc.
If somebody can send me a material of it I will be very glad and thankful
Thanks a lot,
Gildemir Silba
__
Hi all folks,
I would like to know if somebody has a PDF text with the first steps
to use maps in R, like: insert maps, open maps, create adjacency
matrix, make the moran index, etc.
If somebody can send me a material of it I will be very glad and thankful
Thanks a lot,
Gildemir Silba
__
Hello everyone,
I am trying to solve 2D differential equations using finite difference
scheme in R. I have been able to work with the equations with only one
spatial dimensions but I want to extend it to the two dimensional problem.
For example i can simulate one dimensional diffusion using a co
The beauty of trial and error ... if I leave the non x, y parameters i.e. h as
global parameters rather than formal parameters for gaussiankernel it works
fine basically I don't pass anymore h=0.5 to gaussiankernel but consume it from
a global variable. Ugly but works ...
Best regards,
Giovanni
Tena koe Robin
Do you get an error or warning?
It may have something to do with how == treats NA:
x <- 1:4
x[x == 1]
[1] 1
x <- c(1:4, NA)
x[x == 1]
[1] 1 NA
x[x %in% 1]
[1] 1
If so, using %in% is one way to avoid the problem. However, I would
have thought you'd get an error message if this w
Hello,
I have the following function that receives a "function pointer" formal
parameter name "fnc":
loocv <- function(data, fnc) {
n <- length(data.x)
score <- 0
for (i in 1:n) {
x_i <- data.x[-i]
y_i <- data.y[-i]
yhat <- fnc(x=x_i,y=y_i)
score <- score + (y_i - yhat)^2
Hi once again.
just to let you know that i found the answer i need:
http://www.mail-archive.com/r-help@r-project.org/msg65359.html
Thank you once more.
Cláudio
2010/4/24 Cláudio Sá
> Thank you for the quick answer, but i was asking if some method could do
> combinations where numbers of the sa
Thanks Ben. Putting that code into my .Rprofile file helped; then it gets
executed whenever R starts up.
>>>
From: Ben Bolker
To:
Date: 20/Apr/2010 10:05a
Subject: Re: [R] Tinn-R
Robert Ruser gmail.com> writes:
> I want to use the free distribution of R (R REvolution 3.2)
[this is a littl
On 25/04/2010 12:52 PM, Matthew Keller wrote:
Hi all,
Probably a rudimentary question. I have a flat file that looks like
this (the real one has ~10e6 elements):
10110100101001011101011
and I want to pull that into R as a vector, but with each digit being
it's own element. There are no separat
> I shall appreciate any words of directions .
We'll see about that :-)
Read the posting guide!
1. That is a Bioconductor package, so this is the wrong place to look for help.
2. Email the maintainer. We hate to hear about issues form the general list. See
http://bioconductor.org/packages/re
Is there an obvious reason why this won't loop to i=2 and beyond?
There are many combinations of *st* & *vc* that don't exist in svc. For
example, when s=1 there's only an entry at v=1. That's fine, the entry can
stay 0.
lookup.svc <- array(0,dim=c(length(unique(svc$st)),length(unique(svc$vc))),
On 25-Apr-10 21:20:44, Laetitia Schmid wrote:
> Hi,
> I've had a little problem for several weeks now. It is annoying and
> therefore I will ask for help:
> When I write a script with several iterations, I make it write out a
> text file to save the data during the run. For example I write:
> i
Hi useRs,
In trying to take R to engineering undergraduate students, I have been
looking for context that would make R more accessible to the said
audience. Though R is primarily a statistical tool, I would want to
demonstrate the use of R for certain engineering courses (Design of
Machine Elements
RExcel has a VBA command
InsertCurrentRPlot which will put the current R plot into an Excel file.
RExcel is an Excel addin and can be installed
through the package RExcelInstaller available on CRAN.
On 4/25/2010 8:11 PM, Hans-Peter Suter wrote:
>> I am aware of the various packages (xlsReadWrite
Maybe I missed something - but *why* should we do it?
Contact
Details:---
Contact me: tal.gal...@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
Hi,
I've had a little problem for several weeks now. It is annoying and
therefore I will ask for help:
When I write a script with several iterations, I make it write out a
text file to save the data during the run. For example I write:
if (i %% 25) write.table(output,"temporary_output.txt")
L
I have been using R 2.10.1. and Bioconductor but the package "MLIntrefaces"
is not being loaded on my platform.
the error message
Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) :
there is no package called 'coin'
Error in as.environment(pos) :
no item called "newtable" on the searc
Hi,
I've had a little problem for several weeks now. It is annoying and
therefore I will ask for help now:
When I write a script with several iterations, I make it write out a
text file to save the data during the run. For example I write:
if (i %% 25) write.table(output,"temporary_output.txt
Hello R-List,
** This e-mail was initially bounced. Please forgive any duplicates.**
I'm creating a new generic function and 3 associated methods, in
which each of the methods only needs a subset of the arguments
specified in the generic.
So, I create the generic like so (with the signature d
Hi
On 25/04/2010 11:11 p.m., Jim Lemon wrote:
On 04/25/2010 06:27 AM, tamas barjak wrote:
Hi
I do not speak in English very well, I'm sorry.
I try good:
layout(matrix(1:4,ncol=2, byrow=T)) = par(mfrow=c(2, 2))
plot(1,1)<--- anddoes plot in the upper left corner
plot(2, 2)<--- upper right co
Is there an need for more open source math tools in
for-profit companies? If so, would targeted training and support help meet
this need while benefiting the open source community? Please share your
opinions and reasoning by answering the survey questions below.
I've i
On 24.04.2010 20:48, st...@mindspring.com wrote:
I wrote a followup to your old message which had no replies-- my situation is near
identical, and, I wonder if you found a solution. (Running "make check" on R,
failure of stats test.)
Thanks,
If these are the "random" tests, then there i
Hello. I am a student in social science at the University of Lausanne.
I have a problem to solve with R. I'm desperately looking for someone who is
able to solve it.
The problem is the following:
I need to decode a message using a substitution encryption.
First, I must create the encryption in R
Yes, seems a wiser step really.
Thank you!
Tamas
2010/4/25 Jim Lemon
> On 04/25/2010 06:27 AM, tamas barjak wrote:
>
>> Hi
>>
>> I do not speak in English very well, I'm sorry.
>>
>> I try good:
>>
>> layout(matrix(1:4,ncol=2, byrow=T)) = par(mfrow=c(2, 2))
>>
>> plot(1,1)<--- anddoes plot in
Those are great solutions. Thanks so much for your help.
Yours,
Alan
On Sun, Apr 25, 2010 at 11:43 AM, David Winsemius
wrote:
>
> On Apr 25, 2010, at 2:22 PM, Chuck Cleland wrote:
>
>> On 4/25/2010 2:10 PM, Alan Lue wrote:
>>>
>>> Hi,
>>>
>>> Is there a way to specify the last element of a vec
Here you go :)
require(stringr)
t(
apply(mydf, 1, function(x) {str_replace(x, "\\?", "-)")})
)
Contact
Details:---
Contact me: tal.gal...@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co
thx I was struggling with the DF[,3:4] part of it
On Sun, Apr 25, 2010 at 10:47 AM, John Kane wrote:
> Here's one way with aggregate()
>
> library(car) # You probably will need to install it.
>
> aggregate(DF[,3-4], by=list(years), mean,na.rm=TRUE)
>
> recode(x, "c(1,2)='A'; else='B'")
>
> DF$
Hi Peter,
Thanks for the example. It was previously pointed out to me (in a private
message) that the legend wasn't printed by scatterplot() when the groups
variable isn't numeric. In fixing that, I also took care of the problem that
you noticed. The fix is (or actually will be shortly) in the dev
On Apr 25, 2010, at 2:22 PM, Chuck Cleland wrote:
On 4/25/2010 2:10 PM, Alan Lue wrote:
Hi,
Is there a way to specify the last element of a vector, similar to
"end" in
MATLAB?
v[end]
would be MATLAB for
v(length(v))
in R.
While `v(length(v))' does yield the last element, that approa
See readBin(), e.g.
r <- readBin(pathname, what="raw", n=10e6);
str(r);
# raw [1:21] 30 31 30 31 ...
c <- rawToChar(x, multiple=TRUE);
str(c);
# chr [1:21] "0" "1" "0" "1" "0" "0" "1" "0" "1" "0" ...
i <- as.integer(r);
str(i);
# int [1:21] 48 49 48 49 48 48 49 48 49 48 ...
/Henrik
On Sun, Apr
On 4/25/2010 2:10 PM, Alan Lue wrote:
> Hi,
>
> Is there a way to specify the last element of a vector, similar to "end" in
> MATLAB?
>
> v[end]
>
> would be MATLAB for
>
> v(length(v))
>
> in R.
>
> While `v(length(v))' does yield the last element, that approach fails in the
> following,
Hi Alan,
Take a look at the following:
> x <- 1:10
> x[length(x)]
[1] 10
> tail(x)
[1] 5 6 7 8 9 10
> tail(x, 1)
[1] 10
See ?tail for more information.
HTH,
Jorge
On Sun, Apr 25, 2010 at 2:10 PM, Alan Lue <> wrote:
> Hi,
>
> Is there a way to specify the last element of a vector, simila
Hi:
I have the following dataset in R( thanks Gabor for your help) but now
the problem is that all the dashes are converted to questions marks ("?")
I am trying to get the dashes back using:
mydf <- data.frame(lapply(mydf,function(x) replace(mydf,"?"(x),"-")))
but isn't working. I also tried:
Sorry -- I meant `v(end)' and `v[length(v)]' in the first examples of
my message.
Alan
On Sun, Apr 25, 2010 at 11:10 AM, Alan Lue wrote:
> Hi,
> Is there a way to specify the last element of a vector, similar to "end" in
> MATLAB?
> v[end]
> would be MATLAB for
> v(length(v))
> in R.
> Whil
> I am aware of the various packages (xlsReadWrite, RODBC) to get data
> frames into R, but I would like to copy images too.
The xlsReadWritePro version could do it (see code below). It's a
shareware package, but if people need/ask for a gratis license I send
it (please download and check ?xls.lic
Hi,
Is there a way to specify the last element of a vector, similar to "end" in
MATLAB?
v[end]
would be MATLAB for
v(length(v))
in R.
While `v(length(v))' does yield the last element, that approach fails in the
following,
rep(v, each=2)[-c(1,length(v))]
which is meant to duplicate all
See:
https://stat.ethz.ch/pipermail/r-help/2010-January/225841.html
-J
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented,
Check this list for possibilities to try:
http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows&s=excel
On Sun, Apr 25, 2010 at 1:42 PM, Harsh wrote:
> Thank you for the current set of replies.
> I am trying to send an image (png,jpeg) into an excel sheet after I
> have already sent a dat
Here's one way with aggregate()
library(car) # You probably will need to install it.
aggregate(DF[,3-4], by=list(years), mean,na.rm=TRUE)
recode(x, "c(1,2)='A'; else='B'")
DF$years <- recode(DF$years, "c(5,6,7)= '5-7'")
DF
You may also want to have a look at the reshape and plyr packages.
Thank you for the current set of replies.
I am trying to send an image (png,jpeg) into an excel sheet after I
have already sent a data table.
To send a data table I am using (xlsReadWrite package and have also
used the RODBC package). I wanted to create a plot in R and paste it
into Excel from with
On Apr 25, 2010, at 1:13 PM, Harsh wrote:
Hi useRs,
I would like to know what R users are employing to get their
images/plots created in R, into Excel sheets.
I am aware of the various packages (xlsReadWrite, RODBC) to get data
frames into R, but I would like to copy images too.
I guess this
Hi Harsh,
I don't know the answer,
But I would suggest you search and look at:
rcom
Contact
Details:---
Contact me: tal.gal...@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
On 25.04.2010 16:27, Rolf Edberg wrote:
Hi
I am new to R, randomForest and I have read about how to use it in your old
mails. I have also run the predictions examples from CRAN. But I still don't
understand how to use it right.
The thing that I don't understand is how to run the result from
Thank you both for your helpful reply! And apologies for the lack of a
reproducible example - I would/could send one now, but I believe Peter's
example will suffice (and thank you for that). And making z a factor worked
perfectly. Thank you!
Anthony
On Sun, Apr 25, 2010 at 10:20 AM, Peter Ehle
Hi John,
The problem seems to be with the order in which the 'levels' of
the conditioning variable appear. Here's a reproducible example:
Prestige$tp<- with(Prestige, ifelse(type == "prof", 0, 1))
scatterplot(prestige ~ income | tp, data=Prestige)
Note that I've just switched the 0/1 from you
Hi useRs,
I would like to know what R users are employing to get their
images/plots created in R, into Excel sheets.
I am aware of the various packages (xlsReadWrite, RODBC) to get data
frames into R, but I would like to copy images too.
Thank you for any help in solving this problem.
Regards,
H
Hi all,
Quickly received an answer off the list. To do this is easy. Pull it
in using e.g., scan(). Then use strsplit:
z <- '10001011010010'
strsplit(z,'')
On Sun, Apr 25, 2010 at 10:52 AM, Matthew Keller wrote:
> Hi all,
>
> Probably a rudimentary question. I have a flat file that looks like
>
*Solution:*
strsplit(c("10110100101001011101011"), "")
But make sure you change the output data type to the one you like (boolean,
numeric and so on)
Contact
Details:---
Contact me: tal.gal...@gmail.com | 972-52-7275845
Read
Hi all,
Probably a rudimentary question. I have a flat file that looks like
this (the real one has ~10e6 elements):
10110100101001011101011
and I want to pull that into R as a vector, but with each digit being
it's own element. There are no separators between the digits. How can
I accomplish thi
Hello dear R-help mailing list,
The other day I published a blog post (with some R code) to help R-users who
want to implement a simpler upgrading strategy for R (under windows - but
probably the same will be true of mac OS, I am not sure about Linux).
This e-mail has 3 goals: (a) To share, (b) t
Try this. First we read in the lines using readLines. (We use
textConnection here to keep it self contained but you can read it from
the file as shown in the commented out portion.)
Using strapply we match the regular expression to the input. The two
parenthesized portions match the number (\\S+
Dear R Community,
I am trying to optimize a water quality model that I am using. Based on
conversations with others more familiar with what I am doing I plan to
implement DEOptim to do this. The water quality model is interfaced through a
GUI. I have the input file necessary to alter paramet
I presume you want to use such tables to summarize baseline information (a.k.a
"Table 1" in medical papers)
Try the Hmisc package ... will do the tables and statistics for you and save
them as tex (which you can import directly into
in your favorite Office like program after running htlatex)
li
> Many people seem to be reluctant to define functions,
> even thought I think it is a pretty small step from
> writing scripts to writing functions.
I'm not so sure - I find most students struggle to grasp that next level
of abstraction. Generalising from a specific task to a general function
Dear Peter and Anthony,
Thanks, Peter, for answering the question, but scatterplot() should work
even if z is not a factor, and does for me in the following example:
> library(car)
> Prestige$tp <- with(Prestige, ifelse(type == "prof", 1, 0))
> scatterplot(prestige ~ income | tp, data=Prestige)
malcolm Crouch gmail.com> writes:
> 1. Tests for indications of asbestos in the lungs of employees at an
> insulation manufacturer resulted in four persons with positive indications
> of asbestos being sent to a medical center for further testing . if 45% of
> the employees have positive indicati
On Apr 25, 2010, at 1:08 AM, burgundy wrote:
Hi,
I'm trying to assign a score to each row which allow me to identify
which
rows differ. In the example file below, I've used "," to indicate
column
separators. In this example, I'd like to identify that row 1 and row
5 are
the same, and r
Hi
I am new to R, randomForest and I have read about how to use it in your old
mails. I have also run the predictions examples from CRAN. But I still don't
understand how to use it right.
The thing that I don't understand is how to run the result from the
randomForest on one line (post) with
I have previously just extracted the eclipse archive to a folder and ran
eclipse. What might have happened is that not all dependencies must not have
been met. I have just installed Eclipse with apt-get and everything seems to
be working in order.
On Sun, Apr 25, 2010 at 1:58 PM, Tobias Verbeke
Hi ,
I am struggling with these two question . Any help would be appreciated ,Im
looking at doing them on r ?
1. Tests for indications of asbestos in the lungs of employees at an
insulation manufacturer resulted in four persons with positive indications
of asbestos being sent to a medical center
On 25/04/2010 9:07 AM, Albert-Jan Roskam wrote:
Hi,
I'm having trouble seeing the added value over functions defined by setGeneric
vis-a-vis
methods defined by inheritance and polymorphism. setGeneric offers a 'clean' call
to a generic function, ie. no need to call new(), so less typing to do
Hi,
I'm having trouble seeing the added value over functions defined by setGeneric
vis-a-vis
methods defined by inheritance and polymorphism. setGeneric offers a 'clean'
call to a generic function, ie. no need to call new(), so less typing to do for
the user. But such explicit calls can also be
Hi Roman,
Roman Luštrik wrote:
Have you managed to resolve this? I get the same error on Karmic Koala as
well.
Are you sure you're using the latest StatET,
i.e. version 0.8.2, installed from the update
site (for Eclipse 3.5) at
http://download.walware.de/eclipse-3.5
Best,
Tobias
__
On 04/25/2010 06:27 AM, tamas barjak wrote:
Hi
I do not speak in English very well, I'm sorry.
I try good:
layout(matrix(1:4,ncol=2, byrow=T)) = par(mfrow=c(2, 2))
plot(1,1)<--- anddoes plot in the upper left corner
plot(2, 2)<--- upper right corner
BUT, I like plot( n, m) for example lower
Hi,
I'm trying to assign a score to each row which allow me to identify which
rows differ. In the example file below, I've used "," to indicate column
separators. In this example, I'd like to identify that row 1 and row 5 are
the same, and row 2 and row 4 are teh same.
Any help much appreciated.
MARCEL CURLIN wrote:
>
> .
>
> Currently my output looks like:
> [1] Excluded range: Time 00.2
> [4] R^2 =0.111526872884505
> [1] Excluded range: Time 0.2 0.4
> [4] R^2 =0.0706332920267
Have you managed to resolve this? I get the same error on Karmic Koala as
well.
--
View this message in context:
http://r.789695.n4.nabble.com/StatEt-Error-R-Object-Browser-Update-java-lang-NullPointerException-tp1591264p2064072.html
Sent from the R help mailing list archive at Nabble.com.
Thanks I'll try that, still need to understand how the other functions
work.. just to satisfy myself..thanks again
On Sun, Apr 25, 2010 at 12:06 AM, Tal Galili wrote:
> Here is one solution for your question:
>
> mean.data <- with(DF, tapply(data, years, mean, na.rm = T))
> mean.data2 <- with(DF
I would try using something like
read.table
with
read.table(..., sep = "---")
And then clean the variables one by one (you'll need to search the mailing
list for help on time variables. And also for ways to search and replace
text - all exist as answers here)
Cont
Here is one solution for your question:
mean.data <- with(DF, tapply(data, years, mean, na.rm = T))
mean.data2 <- with(DF, tapply(data2, years, mean, na.rm = T))
cbind(mean.data , mean.data2)
Another one would be for you to read about the package plyr (which is better
for this job, actually)
An
85 matches
Mail list logo