search for: nmax

Displaying 20 results from an estimated 55 matches for "nmax".

Did you mean: max
2017 Jun 04
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
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...
2017 Jun 04
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...
1999 Jan 29
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) ) {
2011 Nov 10
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 exa...
2006 Apr 26
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...
2008 Sep 25
Dot plot - equivalent of MINITAB
hi folks, Bit of a newbie, but I''ve spent a fair bit of time looking for an answer on this, with no joy. Can anyone help me? Dataset: A single column of values in a csv file (eg. 52, 53, 54, 85, etc) Goal: In Minitab, you have what they call a dot plot. It''s a histogram, where a single dot represents a set of identical values (eg. 57, 57, 57 would be one dot). Multiple
2010 Aug 18
About scan
Hi folks, I followed an online example to input data; > x = scan(1,2,3,4,5) Error in scan(1, 2, 3, 4, 5) : either specify ''nmax'' or ''n'', but not both. It can''t work. > x = c(1,2,3,4,5) > x [1] 1 2 3 4 5 It works. Whether "scan" is replaced with "c" ? > ?c ..... Usage: c(..., recursive=FALSE) TIA B.R. Stephen L
2017 Aug 13
ggplot's aes_ doesn't work as expected for x=factor()
...) + geom_bar(stat="identity") # works # it doesn't work here, where only change is using x=factor() ggplot(df, aes_(x=factor([2])),[3]),[1]))) + geom_bar(stat="identity") # doesn't work Error in unique.default(x, nmax = nmax) : unique() applies only to vectors # aes_ does work if I make the x variable a factor ahead of time df2 <- df df2$Var1 <- as.factor(df2$Var1) ggplot(df2, aes_([2]),[3]),[1]))) + geom_bar(stat="identity") # works...
2013 Jan 28
gigFit problems
...etely off into strange territory. I hope that fixing the above problem would fix this. ---------------------------------------- Problem three: When I do the above with plot gigFit(dataVector,plot=TRUE) I get a warning Warning message: " In incompleteBesselK(x[i], y[i], -lambda, tol = ibfTol, nmax = nmax) : Maximum order exceeded Result may be unreliable " Ray -- This space is for my comments on the world (Intentionally left blank.)
2012 Oct 20
Error: not 'a real'?
...r","numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric") # Error: Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, (from #2) : scan() expected ''a real'', got ''894.6'' How is ''894.6'' not ''a real [number]''? Thanks for the ensuing enlightenment or punishment... Best, Brian
2007 Dec 12
Importing Large Dataset into Excel
...t the data with the following line of code: > newborn<-read.table("newborn edit.csv", header=T, sep=",") where "newborn edit.csv" is the name of the file. Unfortunately, I''m getting back the following error message: "Error in scan(file,, what, nmax, sep, dc, quote, skip, nlines, na.string, : line 528 did not have 44 elements" As far as I can tell, line 528 of the spreadsheet table does have the same number of elements as the other rows - by chance can this error message mean anything else? Also, is there an easier way to import data f...
2008 Sep 19
Novice question about getting data into R
I found it easy to use R when typing data manually into it. Now I need to read data from a file, and I get the following errors: > refdata = > read.table("K:\\MerchantData\\RiskModel\\refund_distribution.csv", header > = TRUE) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 42 elements > refdata = > read.table("K:\\MerchantData\\RiskModel\\refund_distribution.csv") Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 2 did not have 42 elements > (...
2003 Jun 26
krige in gstat() package
HI, I wonder does anyone have experience with doing sequential gaussian simulation with krige() function in gstat? I find it VERY slow compared to use krige() to achieve kriging function itself.. I wonder why, is that because it has to model the variogram, and do the kriging separately for each point to be simulated? so it would be N times slower to achieve the simulation than the kriging if
2010 Nov 28
Finding root of quadratic equation
Dear R Helpers, I need to find the root of following equation. 0.0016^2 = (0.001*x)^2 + (0.002 * (1-x))^2 + 2 * 0.7 *0.001*0.002 * x * (1-x). I had tried using "animation " package as follows. # My Code library(animation) ani.options(nmax = 500) solu = newton.method(function(x) 0.0016^2 - 0.001^2*x^2 - 0.002^2*(1-x)^2 - 2*0.7*0.001*0.002*x*(1-x), 1, c(-1,1)) solu$root # However, I am not getting the solution. Please guide. Amy [[alternative HTML version deleted]]
2013 Nov 18
Reading in csv data with ff package
...pecifying colClasses): ------------------------------------------------- > data = read.csv.ffdf(x=NULL,file="data.csv",nrows=1001,first.rows = 500, next.rows = 1005,sep=",",colClasses = c("integer","integer","logical"))Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : scan() expected ''an integer'', got ''"J"''> data = read.csv.ffdf(x=NULL,file="data.csv",nrows=1001,first.rows = 500, next.rows = 1005,sep=",",colClasses = c("integer","c...
2006 Jan 11
Levelplot not working from file
...the levelplot function from a command file. Here is the code: library(sp) library(gstat) library(lattice) gatherData <- read.table("~/gather.txt", header = TRUE) grd = makegrid(gatherData$x, gatherData$y, cell.size = 5) k <- krige(z~x+y, ~x+y, data = gatherData, newdata = grd, nmax = 5) levelplot(var1.pred~x+y, k, aspect = mapasp(k), main = "Predicted 5m") It executes fine (it plots up) when I cut and paste to the command prompt but it seems to be missed (nothing occurs) when I call the source file. I am using OSX. Thanks for any help. Matt [[alternative text...
2013 Oct 04
Tab Separated File Reading Error
Hello, I have a seemingly simple problem that a tab-delimited file can''t be read in. > annoTranscripts <- read.table("matched.txt", sep = ''\t'', stringsAsFactors = FALSE) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 5933 did not have 12 elements However, all lines do have 12 columns. > lines <- readLines("matched.txt") > tabsPosns <- gregexpr("\t", lines) > table(sapply(tabsPosns, length)) 11 367274 > system(...
2008 Mar 20
Importing an Excel spreadsheet
....convert(data[[i]], =[i], dec = dec, na.strings = character(0)) : invalid multibyte string at ''?????'' So I copied it all over to a text document and tried to import that, thus: > read.table("A5.txt") The error I got then was: Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 26 did not have 34 elements Having gone over the line in question, it all seems to be the same as any other row. I really don''t want to have to manually re-enter the data (some 98 rows x 26 columns). Can someone advise me on what I am...
2013 May 15
error de lectura
Buenos días Al leer el fichero esudbp.csv personas <-read.table("esudb11p.csv", header=TRUE, sep=",") Me da el siguiente error: Mensajes de aviso perdidos In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : número de items leídos no es múltiplo del número de columnas No entiendo por qué no puede leer este cuarto fichero, si es igual que los anteriores pero con más variables. Gracias ________________________________ GOBIERNO DE LA RIOJA AVISO...