similar to: How to count the number of parameters in a function

Displaying 20 results from an estimated 5000 matches similar to: "How to count the number of parameters in a function"

2003 Dec 11
4
Probelm with read.table
Hi All, I have the following text file (mytextfile.txt) 738307 527178 714456 557955 #N/A 17.42 6.22 4.73 #N/A 17.3 6.23 4.75 #N/A 17.29 6.17 4.7 #N/A 17.07 6.12 4.6 #N/A 17.27 6.19 4.7 #N/A 17.72 6.4 4.78 #N/A 17.12 6.19 4.75 #N/A 17.07 6.15 4.65 #N/A 17.03 6.07 4.64 #N/A 17.38 6.13 4.7 #N/A 17.38 6.13 4.7 #N/A 17.38 6.13 4.7 #N/A 17.38 6.13 4.7 #N/A
2009 Nov 12
1
Reading a data file one record at a time [SEC=UNCLASSIFIED]
Dear r-help, I have a radar data file in the following format: nrays for (1 to n_rays) { some_data_info for (1 to n_gates) { some_data_info} } N_rays=360 and n_gates=950 The data looks something like: Header line1 Ray1 header gate1 var1, var2,.....,varN ... gate950 var1, var2,.....,varN Ray2 header gate1 var1, var2,.....,varN ...
2016 Oct 11
3
Colapsar una matriz con NA en una única fila
Javier Muchas gracias por su respuesta Aunque no está funcionando, pues si ejecuto: EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var1),] obtengo Var1, Var2, Var3,...Varn con datos "texto", NA, NA....NA Pero al ejecutar EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var2),] obtengo Var1, Var2, Var3,...Varn con datos NA,"texto", NA....NA Estoy tratando de dar la vuelta con el loop
2003 Nov 24
3
Bollinger Bands
Is there a way to create Bollinger Bands without having to loop on the observations of a time serie? Any help appreciated Thanks
2011 Jun 17
4
profile plot in R
Hi friends, I have a matrix with following format. group var1 var2 .......varN c1 group1 1.2399 1.4990....-1.4829 c2 group4 0.8989 0.7849.....1.8933 ... ... c100 group10 ..... I want to draw a profile plot of each condition c1 to c100, which rows in above matrix and each line representing a row should be uniquely colored according to the group(1 to 10). I think this is simple task
2001 Apr 03
2
Still need help w/ making a table
Greetings again. I'm still trying to coerce a pile of data into a frequency table format. I've managed to do so using perl, so I now have a tab-delimited file that contains the contingency table I'm trying to use: Group var1 var2 ... varn B 42 11 3 C 44 1 12 ... X 12 0 19 I can read the table in using read.table(), but I end
2011 Apr 02
4
help
Dear R Help group I need to run a command line script from within R session. I am not clear how i can acheive this. I tried shell and system function, but i am missing something critical.can someone provide help? My intention is to create a pdf file of a plot in R and then attach existing files from my system as attachment into the newly created pdf file. Any help would be greatly appreciated..
2016 Oct 11
2
Colapsar una matriz con NA en una única fila
Hola Consulto por un problema que no consigo resolver. Tengo un dataframe con muchas columnas todas de texto. Cada columna tiene solamente un valor válido y el resto son NAs. También cada fila tiene un único valor válido. Quiero colapsar ese data frame en uno que tenga solamente una fila y todas las columnas. Intenté con loops, while, apply y otros parecidos pero no lo logro El ejemplo del
2003 May 01
4
var[i]
Dear all, How could I use variables in a loop that their names are in a vector? For example: aaa <- 1:10 bbb <- aaa*2 ccc <- aaa+bbb varn <- c("aaa", "bbb", "ccc") m <- rep(NA, 3) for (i in 1:length(varn)) m[i] <- mean(varn[i]) # wrong thanks in advance Juli -- "Wars do not solve problems, wars generate even more problems"
2002 Nov 26
2
URGENT Help required
I've the following problem: The below function runs a loop with regression analysis and stores F-Stat in a matrix. When I call the matrix elements (models[i,j]) in the function I get proper results, but when I try to call the same elements outside the function the matrix appears to be empty e.g when I call compt inside the function I get: 5 but when I call it outside I get: 1. This is the
2011 Jun 07
2
What is wrong in m
Hi everyone, What is wrong in below asterisk application? The output should be content of field booth_status from table booths: [extension-status] exten => _X.,1,MYSQL(Connect connid 127.0.0.1 root password my-extensions) exten => _X.,n,MYSQL(Query allow_call ${connid} SELECT extension_status FROM mytable WHERE extension=${CALLERID(num)} ORDER BY id DESC LIMIT 1) exten =>
2003 May 20
1
Extracting elements from an reStruct
Sorry if this is obvious, but my S skills aren't great and I haven't been able to find it documented anywhere. I want to write a new function for use with lme objects; the function will simply calculate an ICC (aka "rho") for each level of a mixed-effects model. What I need for this is pretty simple: (c(var1..varn, residual)) / sum(c(var1..varn, residual)) where var1..varn
2010 Jan 12
4
Beginer data.frame
Hello, I use R 2.10, and I am new in R (I used to use SAS and lately Stata), I am using XP. I have a data which has a data.frame format called x.df (read from a csv file). I want to take from this data observations for which the variable "Code" starts with an "R". I took all the Code and put them into a vector vec<-grep("R[A-Z][A-Z]",x.df$Code,value=TRUE) Then I
2004 Apr 07
1
Time Varying Coefficients
I'd like to estimate time varying coefficients in a linear regression using a Kalman filter. Even if the Kalman Filter seems to be available in some packages I can't figure out how to use it to estimate the coefficients. Is there anyway to do that in R? Any help appreciated Thanks
2007 Dec 09
1
List comprehensions for R
Below is code that introduces a list comprehension syntax into R, allowing expressions like: > .[ sin(x) ~ x <- (0:11)/11 ] [1] 0.00000000 0.09078392 0.18081808 0.26935891 0.35567516 0.43905397 [7] 0.51880673 0.59427479 0.66483486 0.72990422 0.78894546 0.84147098 > .[ .[x*y ~ x <- 0:3] ~ y <- 0:4] [,1] [,2] [,3] [,4] [,5] [1,] 0 0 0 0 0 [2,] 0 1 2
2007 Feb 22
4
Sorting rows of a binary matrix
Hallo, The command: x <- 3 mat <- as.matrix(expand.grid(rep(list(0:1), x))) generates a matrix with 2^x columns containing the binary representations of the decimals from 0 to (2^x-1), here from 0 to 7. But the rows are not sorted in this order. How can sort the rows the ascending order of the decimals they represent, preferably without a function which converts binaries to decimals
2002 Jan 06
2
Passing names of variables to functions
Hi, I am still new to R and have a programming question. I have created a small function which takes a parameter. In the function I want to be able to refer to the names of the variables sent to the function (specifically I want to be able to use the name of the variable given to the function in an output table). For example, in the following (fictional) function I want some way of printing
2013 Mar 25
1
count NAs with aggregate
Dear members of this list, I'd like to count missing values using the aggregate function. Something like this: count_nas <- function(arg1) { return(sum(is.na(arg1))) } aggregate(cbind(var1, var2, var3) ~ subject + time, data = mydataset, count_nas) It's not working: I end up with a matrix containing zeros, although there are missings in the data frame. I'd highly
2009 Sep 22
3
converting a character vector to a function's input
Hi all, I have been trying to solve this problem and have had no luck so far. I have numeric vectors VAR1, VAR2, and VAR3 which I am trying to cbind. I also have a character vector "VAR1,VAR2,VAR3". How do I manipulate this character vector such that I can input a transformed version of the character vector into cbind and have it recognize that I'm trying to refer to my numeric
2014 Apr 11
6
crear variable en base a nombre de columnas que tienen un 1
Buenos días. Hoy ando un poco (o bastante) espeso y no doy con la tecla de una cosa que seguro que es muy simple.. Pongo un ejemplo. var1 <- c(rep(0,3),rep(1,2)) var2 <- c(rep(1,2),0,0,1) var3 <- c(rep(1,2),rep(0,3)) var4 <- c(rep(1,2),rep(0,3)) datos <- data.frame(fila=1:5,var1, var2, var3, var4) datos datos fila var1 var2 var3 var4 1 1 0 1 1 1 2 2 0