Displaying 20 results from an estimated 11000 matches similar to: "how to break the loop using sapply?"
2014 Oct 20
1
HOW to call R code from matlab?
Dear expeRts,
?? I am fammilar with matlab , i want to call some r codes from it , what can i refer?
?I tried R.matlab. But it seems can't work well. so, do you have any other suggestions?
--
PO SU
mail: desolator88 at 163.com
Majored in Statistics from SJTU
2014 Aug 22
1
what are labels in struct sxpinfo_struct from Rinternals.h mean?
Dear Rdevelers,
? ? ?The following struct is in the Rinternals.h. I want to know ?the meanings of labels or names like "gp,mark,obj,named,trace....." . TKS!
struct sxpinfo_struct {
? ? SEXPTYPE type ? ? ?: ?5;/* ==> (FUNSXP == 99) %% 2^5 == 3 == CLOSXP
? ? * -> warning: `type' is narrower than values
? ? * ? ? ? ? ? ? ?of its type
? ? * when SEXPTYPE was an enum
2014 Sep 12
1
using pdf(file="") encount a Chinese garbled
Dear expeRts,
??? When i use the following codes:
??? pdf(file="1.pdf",width=15)
? ? plot(1:3,main="??")
??? dev.off()
#There were 12 warnings (use warnings() to see them)
? I find that "??" can't show correctly in pdf file, but? i just ?plot(1:3,main="??") to R plot viewer, it's ok .
? Is there anyone happen to know the solution? BTW, i explore the
2014 Sep 04
2
The newest version of Rstudio Desktop v0.98.1049 couldn't be installed
Dear expeRts,
?? I find the newest Rstudio Desktop v0.98.1049 ?for windows is not newest, after i installed, it was a old version.
--
PO SU
mail: desolator88 at 163.com
Majored in Statistics from SJTU
2015 Jun 19
1
QT + RInside problem complement
The solution post is here:
http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-November/004771.html
In the paragraph:
I did need however to install Rcpp and RInside from source, and with the same
compiler used to compile qtdensity (otherwise I would get additional linker
errors). As I had trouble getting the (Cygwin-based) g++ shipped with Rtools
to work with Qt, I used instead the
2012 Jan 20
3
break an axis.POSIXct
Hi
I like to use "axis.POSIXct" to plot days from 2006 till 2008. But I
only have datas for the summer months. Is it possible to get two axis
breaks, to have not so long distances without points?
thx
Christof
2013 Jan 25
5
Loop question?
Dear All
I have the following data (somewhat simplyfied):
TINF <-1
a <-c(500,750,1000,1250,1500,1750,2000)
b <-c(8,12,18,24,36,48,60,72,96)
following function:
infcprodessa <-function (D, tin, tau, ts)
(D * (1 - exp(-0.048 * tin))/(tin * (0.048*79) * (1 - exp(-0.048 * tau)))) * exp(-0.048 * (ts - tin))
z <-sapply(1:1, function(n) infcprodessa(1000,TINF,12,12-TINF))
is
2012 Apr 23
2
.rda vs. .RData
Are they the same with .RData being the newer format?? Thanks,
...Tao
2013 Oct 10
1
Rcpp and mclapply
Dear all,
I have an R script that uses Rcpp, and I have been trying to parallelize
it using mclapply (I tried with the multicore and the parallel library)
Sometimes (not always, interestingly), the CPU use for each core drops,
usually so that the total over all cores reaches 100%, i.e., as fast as if
using just one single core fully. I tried my code directly from within
emacs, and also using a
2013 Oct 12
1
lmerTest
Hi,
I'm trying to user lmer function from lmerTest package because, if I
understood correectly, it allows to make better inference than lmer method
from lme4 package. However, whatever I do I keep getting this error:
Error in lme4::lFormula(formula = mark ~ ssCount + sTime+ : rank of X =
1660 < ncol(X) = 1895
any ideas what could be a problem?
thanks,
Srecko
[[alternative HTML
2011 Mar 25
2
Preserving the class of POSIXt objects
Dear all,
I am working with a list of objects each of which contains two POSIXct
objects (say, $Start and $End) and a number of different data in
addition to that. Now an easy way to extract Start times of all object
could be sapply(x, "[", "Start") but this converts them all to
numeric, and so does sapply(x, "[[", "Start"). lapply preserves the
class but
2012 Nov 11
2
Cropping a matrix by rows
Hello r-help,
I've been banging my head against the computer in an attempt to learn how
to divide my matrix into segments by rows. I want to be able to return each
segment as a newly named object. I've tried looking at the apply functions
and creating a for loop but brain no work. Here's the basic starting
objects that I believe would be needed to separate the matrix.
mat <-
2018 Mar 12
1
Equivalent of gtools::mixedsort in R base
x <- c( "a1", "a10", "a2" )
y <- c( "b10", "b2", "a12", "ca1" )
DF <- expand.grid( x = x, y = y )
# randomize
set.seed( 42 )
DF <- DF[ sample( nrow( DF ) ), ]
# missing from gtools
mixedrank <- function( x ) {
seq.int( length( x ) )[ gtools::mixedorder(x) ]
}
o <- do.call( order, lapply( DF, mixedrank ) )
2012 Apr 19
2
Trouble with [sv]apply
Friends
I clearly donot understand how sapply and vapply work.
What I have is a function that returns a matrix with an indeterminate
number of rows (some times zero) but a constant number of columns. I
cannot reliably use an apply function to assemble the matrices into a
matrix. I am not sure it is possible.
I can demonstrate the core of my confusion with this simple code.
A.f <-
2011 Aug 14
1
FYI : XML 3.4.2 still breaks odfWeave 0.7.17
Dear list,
perusing the GMane archive shows that the issue with XML 3.4.x still bugs
odfWeave users.
I just checked that the newer XML 3.4.2 version still give the same
problem. Using it to weave a bit of documentation written with LibreOffice
3.3.3 (current in Debian testing) leads me to a 192 Kb, 590 pages
document, whereas reinstalling XML 3.2.0 gives me a 4 pages, 24Kb file
(not
2010 Jul 19
2
error when copy and transform within a data frame
# trying to do a copy and a transform within a data frame, but getting the
"arguments imply differing number of rows" error, and I'm not sure why
a=c(1,2,3)
b=c(2,3,4)
c=c("Yes","No","Yes")
d=c("No","Yes","No")
df=data.frame(a,b,c,d)
# the following works fine!
df = transform(df, new=sapply(df[,c(1,2)], FUN = function(x)
2011 Nov 25
3
counting values with some conditions in a simulation
Dear R users,
I am running simulations (1000), and in my simulation I am looking at
specific sums. For example, if the sum is >=4 then count this, if say <3,
then don't count, if the sum=3, then generate a random number from uniform
distribution, if this number is say less than 0.5, then count this sum, if
greater than 0.5, then don't count. I am having trouble with introducing
this
2012 Jan 11
3
64bit R under 32bit winxp
Hi all:
My OS is 32bit winxp,but I wanna install 64bit R2.14.1.
>From the following website,it says "You can also go back and add 64-bit components to a 32-bit install, or vice versa"
http://cran.r-project.org/bin/windows/rw-FAQ.html#Can-both-32_002d-and-64_002dbit-R-be-installed-on-the-same-machine_003f
Does it mean that I can install and run 64bit R2.14.1 under 32bit
2011 Aug 15
3
write.table extra column
In the following data.frame there are 6 columns, but 7 are written to
the CSV file.
install.packages("pmlr")
library(pmlr)
data(enzymes)
write.table(enzymes, sep=",", eol="\n",file="albert.csv")
2012 Mar 12
3
Idea/package to "linearize a curve" along the diagonal?
Hi,
I am trying to normalize some data. First I fitted a principal curve
(using the LCPM package), but now I would like to apply a
transformation so that the curve becomes a "straight diagonal line" on
the plot. The data used to fit the curve would then be normalized by
applying the same transformation to it.
A simple solution could be to apply translations only (e.g., as done
after a