Displaying 20 results from an estimated 215 matches for "nmax".
Did you mean:
max
2017 Jun 04
2
nmax parameter in factor function
I have been trying to understand how the argument 'nmax' works in
'factor' function. R-Documentation states - "Since factors typically
have quite a small number of levels, for large vectors x it is helpful
to supply nmax as an upper bound on the number of unique values."
In the code below what is the reason for error when value of...
2017 Jun 04
1
nmax parameter in factor function
I'll go just a bit "fer-er." It appears the anomaly -- I hesitate to
call it a bug -- is in the C code for duplicated.default():
> duplicated(letters[1:10],nmax=10)
[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> duplicated(letters[1:10],nmax=9)
[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> duplicated(letters[1:10],nmax=8) ## for all nmax <9
Error in duplicated.default(letters[1:10], nmax = 8) : hash table...
2017 Jun 04
0
nmax parameter in factor function
Well, you won't like this, but it is kind of wimpily (is that a word?)
documented:
If you check the code of factor(), you will see that nmax appears as
an argument in a call to unique(). ?unique says for nmax, "... see
duplicated" . And ?duplicated says:
"If nmax is set too small there is liable to be an error: nmax = 1 is
silently ignored."
So sometimes you get an error when nmax is too small with the hash
table e...
2010 Jun 18
3
Use of .Fortran
I have no experience with incorporating Fortran code and am probably
doing something pretty stupid.
I want to use the following Fortran subroutine (not written by me) in
the file SSFcoef.f
subroutine SSFcoef(nmax,nu,A,nrowA,ncolA)
implicit double precision(a-h,o-z)
implicit integer (i-n)
integer l,i,nmax
double precision nu,A(0:nmax,0:nmax)
A(0,0) = 1D0
do l=1,nmax
do i=1,l-1
A(l,i) = (-nu+i+l-1D0)*A(l-1,i)+A(l-1,i-1)
end do
A(l,0) =...
2010 Jun 18
3
Use of .Fortran
I have no experience with incorporating Fortran code and am probably
doing something pretty stupid.
I want to use the following Fortran subroutine (not written by me) in
the file SSFcoef.f
subroutine SSFcoef(nmax,nu,A,nrowA,ncolA)
implicit double precision(a-h,o-z)
implicit integer (i-n)
integer l,i,nmax
double precision nu,A(0:nmax,0:nmax)
A(0,0) = 1D0
do l=1,nmax
do i=1,l-1
A(l,i) = (-nu+i+l-1D0)*A(l-1,i)+A(l-1,i-1)
end do
A(l,0) =...
2013 Oct 30
1
unique(1:3,nmax=1) freezes R
Dear all,
I was playing around with factor contrasts, and found the argument nmax on function factor. When using nmax=1, R froze completely, and I had to close it from task manager. After some debugging, I found that the problem is actually in unique-function, where the internal unique function is called:
.Internal(unique(x, incomparables, fromLast, nmax))
More generally, it...
2004 May 01
5
skip lines on a connection
...not necessarily at the beginning of the file). One way is to
use read lines, e.g. readLines(1e6), but a) this incurs the overhead of
construction of the return char vector and b) has a (fairly remote)
potential to blow up the memory.
Another way would be to use scan(), e.g.
scan(con, skip=1e6, nmax=0)
but somehow this doesn't work:
> scan(con, skip=10, nmax=0)
Error in scan(con, skip = 10, nmax = 0) :
"scan" expected a real, got "A;12;0;"
I can stick to readLines, but am curious if there is a better way.
I use R-1.8.1 on RH-7.3.
Thanks,
Vadim
[[al...
2012 Nov 12
2
how to enter a string value
hi,
I want to know just enter a string value
entering a numeric value is make with the function scan () or scan (nmax =
..)
but it does not work for string
my goal is to enter three string: name and surname and date of birth
I try with this code but it shows me errors
print ("enter the name")
name <- scan (nmax = 1)
print ("enter the first name")
firstName <- scan (nmax = 1)
print (&...
2013 May 02
1
function gstat r with pyhton
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130502/8bc15613/attachment.pl>
2011 Mar 19
2
problem running a function
...c.usgs.gov/pubanalysis/roylebook/panel4pt1.fn
that applied to my data and in the console is as follows:
> `desman.y` <- structure(c(3L,4L,3L,2L,1L), .Names = c("1", "2", "3", "4",
> "5"))
>
> RN<-function(y=desman.y,J=5,nsites=39,Nmax=100){
+ ####
+ lik<-function(parms){
+ r<-expit(parms[1])
+ lambda<-exp(parms[2])
+ pvec<-1-(1-r)^(0:Nmax)
+ gN<-dpois(0:Nmax,lambda)
+ gN<-gN/sum(gN)
+ lik<-rep(NA,nsites)
+ for(i in 1:nsites){
+...
2005 Jun 13
1
memory allocation problem under linux
I have some compiled code that works under winXp but not under linux (kernel
2.6.10-5). I'm also using R 2.1.0
After debugging, I've discovered that in this code:
#define NMAX 256
long **box;
...
box = (long **)R_alloc(NMAX, sizeof(long *)); //<---HERE THE SIGSEGV
for (i=0; i<NMAX; i++) box[i] = (long *) R_alloc(NMAX, sizeof(long));
inside the *first* call to the function R_alloc I have a segmentation fault.
Changing R_alloc with Calloc and malloc giv...
1999 Jan 29
1
cex
Hi,
I was hoping someone could help me with this problem. I’m trying to produce
what can be referred to as L’Abbe plots, where a character (my preference
is a circle) is plotted at some specified co-ordinates and the size of the
character is proportional to a weighting variable. I’ve tried this
plot (x, y, type="n")
size <- weight/mean(weight)
for ( i in 1:length(x) ) { points
2005 Jun 12
1
memory allocation problem under linux
I have some compiled code that works under winXp but not under linux (kernel
2.6.10-5). I'm also using R 2.1.0
After debugging, I've discovered that this code:
#define NMAX 256
long **box;
...
box = (long **)R_alloc(NMAX, sizeof(long *));
gives a null pointer, so subsequent line:
for (i=0; i<NMAX; i++) box[i] = (long *) R_alloc(NMAX, sizeof(long));
gives a SIGSEGV signal.
In the same shared library, I have a function with this code:
partitions=16;...
2012 Dec 02
6
Warning message: In scan(file, what, nmax...)
Dear R-users,
When i try -
Data1<-read.table("/Users/kama/Analysis/GDP10.csv",header=TRUE,sep=";") i
am getting this error: Warning message: In scan(file, what, nmax, sep, dec,
quote, skip, nlines, na.strings, :
number of items read is not a multiple of the number of columns
I wonder what Iam doing wrong. i guess it is something simple, however, i do
not understand the help-function in R.
Thank you,
Regards,
Faradj
Stockholm university
Department of P...
2011 Nov 10
2
performance of adaptIntegrate vs. integrate
...,
I = int_a^b f(x) dx
where the integrand f: x in IR -> f(x) in IR^p is vector-valued.
integrate() only allows scalar integrands, thus I would need to call
it many (p=200 typically) times, which sounds suboptimal. The cubature
package seems well suited, as illustrated below,
library(cubature)
Nmax <- 1e3
tolerance <- 1e-4
integrand <- function(x, a=0.01) c(exp(-x^2/a^2), cos(x))
adaptIntegrate(integrand, -1, 1, tolerance, 2, max=Nmax)$integral
[1] 0.01772454 1.68294197
However, adaptIntegrate appears to perform quite poorly when compared
to integrate. Consider the following example...
2012 Feb 29
1
Replace back slashes with forward slashes?
...his to the "sos" package and issue a new release
very soon. (The new release is needed, because the RSiteSearch
capability has been modified in a way that breaks the current "findFn"
core of "sos".)
Thanks,
Spencer
back2forwardslash <- function (nmax = 1, pattern = "\\", replacement =
"/") {
x <- scan(what = character(), quote = pattern, nmax = nmax)
x. <- gsub(pattern, replacement, x, fixed = TRUE)
paste(x., collapse = " ")
}
(x <- back2forwardslash())
c:\Users\
# nmax must be one more t...
2008 Feb 08
2
Applying lm to data with combn
...e it work for lm!!
Any help please!
fruit = read.csv(file="test.data.csv",head= TRUE, sep=",")# read it in
matrix format
#fruit =read.file(row.names=1)$data
mD =head(fruit[, 1:5])# only first five used in combinations
#X.SSMII = head(fruit[, 6])# Keep it for referebce
nmax = NULL
n = ncol(mD)# dont take the last column for reference purpose
if(is.null(nmax)) nmax = n
mDD = apply(combn(5, 1),1, FUN= function(y) mD[, y])# to
fg = lm( X.SSMII ~ X.GDAXI + X.FTSE + X.FCHI + X.IBEX, data = mDD )#
regress on combos
s = cbind(s, Residuals = residuals(fg))# take resid...
2006 Apr 26
2
Memory usage and limit
....
The whole data set is about 600 MB when stored as plain ASCII file.
The following code was used in the benchmarking runs:
c = list(var1=0, var2=0, var3="", var4="", .....var65="")
A <- scan("test.dat", skip = 1, sep = ",", what = c, nmax=XXXXX,
quiet=FALSE)
summary(A)
where XXXX = 1000000 or 2000000
I made two runs with nmax=1000000 and nmax=2000000 respectively. The first
run completed successfully, in about hour of CPU time. However, the actual
memory usage exceeded 2.2GB, about 7 times of the acutal file size on disk.
The...
2009 Nov 10
3
Error: cannot allocate vector of size...
I'm trying to import a table into R the file is about 700MB. Here's my first
try:
> DD<-read.table("01uklicsam-20070301.dat",header=TRUE)
Error: cannot allocate vector of size 15.6 Mb
In addition: Warning messages:
1: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
Reached total allocation of 1535Mb: see help(memory.size)
2: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
Reached total allocation of 1535Mb: see help(memory.size)
3: In scan(file, what, nmax, sep, dec, quote, skip, nline...
2012 Jun 10
1
Convert "\" to "/"?
...expected input"). I have so
far not found a way to eliminate the warning without wrapping examples
in "\dontrun" or making the examples hard to understand; neither of
these alternatives are acceptable.
The following is my current solution:
back2ForwardSlash <- function(nmax=1, what=character(), sep='\n', ...){
x2 <- scan(what=what, nmax=nmax, sep=sep, ...)
x. <- gsub('\\', '/', x2, fixed = TRUE)
}
(x <- back2ForwardSlash())
c:\Users\
all.equal(x, 'c:/Users/')
# TRUE
x2. <- back2ForwardSlash(2)
c:\u\a b\n o
d:/pqr/
all....