similar to: How to get the input of a function right?

Displaying 20 results from an estimated 10000 matches similar to: "How to get the input of a function right?"

2012 May 02
2
How can a function in R handle different types of input?
Hi, How can a function in R handle different types of input? I have written a function, which should calculate the slope from several 3-time-point measurements by linear regression 4 three-time-point-measurements: x<-cbind(c(1,2,3,4),c(2,3,4,5),c(3,4,5,6)) time points: time<-c(1,3,9) function for calculating the slope by linear regression: fit<-function(xx,t){slope <-
2012 Mar 12
1
Get a subset
Hi, I have a list of names (alphanumeric characters) and each row by itself contains a different number of names seperated by a semicolon (";"). There are also rows with no entry. I would like to have the name before the first semicolon in each row, if there is any entry. Does anyone have an idea how to solve this in R? Thank you! Stella -- View this message in context:
2009 Aug 12
3
Random sampling while keeping distribution of nearest neighbor distances constant.
Dear All, I cannot find a solution to the following problem although I imagine that it is a classic, hence my email. I have a vector V of X values comprised between 1 and N. I would like to get random samples of X values also comprised between 1 and N, but the important point is: * I would like to keep the same distribution of distances between the X values * For example let's say N=10 and
2011 Jul 16
2
Finding all rows of a matrix equal to vector
Hi everyone, my question might be very trivial, but I could not come up with an answer... I want to find out how often a matrix contains a certain vector as row: x1<-c(1,2,3) x2<-c(1,5,6) x3<-c(7,8,9) A<-matrix(c(rep(x1,5),rep(x2,5),rep(x3,5),rep(x1,5)),nrow=20,ncol=3,byrow=T) How can I find out, how many times x1 is a row of A? Thanks in advance and best regards, Sebastian
2009 Jan 09
3
create sequences from two "from" and "to" vectors
hi all, how can I create sequences that start from a known vector, say x1 and end with another say x2- also suppose all the sequences will be the same length. I don't want to use a for loop x1<-c(1,2,3,4); x2<-(3,4,5,6); what I want is 1 2 3 4 2 3 4 5 3 4 5 6 Thanks ----- Yasir H. Kaheil Columbia University -- View this message in context:
2010 Dec 14
2
How to left or right truncate a character string?
Hi R-helpers, I have a character string, for example: "lm(y ~ X2 + X3 + X4)" from which I would like to strip off the leading and trailing quotation marks resulting in this: lm(y ~ X2 + X3 + X4) I have tried using gsub() but I can't figure out how to specify the quotation mark using a regular expression. Alternatively, I would like a function that lets me delete the leading
2018 Nov 14
2
Building LLVM with VisualStudio 2017
Hey Bjorn, Were you able to figure this out or is it still broken for you? Our scenario is a little bit different, but I have a theory as to what may be going wrong. What linker are you using when you compile your project with clang-cl? I am wondering whether the version of the linker and/or the libraries that you are using is too old in comparison to the one used for the clang compilation.
2002 Apr 18
2
naming boxes in boxplot
Hi, this may be a too simple question, but I was not able to find how to do it. So when I boxplot two vectors, i.e. x<-rbind(1,2,3,4) y<-rbind(3,4,5,6) boxplot(x,y) , could somebody tell me how to name the two boxes as apple and banana? Thanks much, Haun __________________________________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
2008 Sep 19
1
frequency table across multiple variables
Dear R users, I have a dataframe like this: x1<-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4) x2<-c(2,3,4,3,4,3,4,2,2,3,4,NA,NA,NA,NA,4,3) x3<-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,1,2) m<-data.frame(x1,x2,x3) I would like to create a frequency table like this: x1 x2 x3 NA 1 2 3 4 where the values in each cell would be the count of the value for that variable. How can I do
2003 Sep 10
2
dataframe subsetting
I can create a small dataset, "x" below, and subset out rows based on values of a certain variable. However, on the dataset I'm working on now, "latdata" below, I get a subscript error. Any advice is appreciated! Ryan Successful: > is.data.frame(x) [1] TRUE > x X1 X2 X3 1 1 3 5 2 2 4 6 > x[x$X2 %in% c(3),] X1 X2 X3 1 1 3 5 Unsuccessful: >
2008 Dec 01
1
Attempting to get a STELLA model into R
To whomever may be of help, I am a student in a graduate modeling class at the University of North Carolina at Wilmington. I am trying to get a STELLA model converted into R. I am in the process of trying to 're-write' the script into R, but I seem to be missing pieces (i.e. parm values) that are keeping me from being able to replicate this model into R. Does anyone have an idea of a
2010 Jun 01
2
Help on aggregate method
Dear R experts, I would really appreciate if you had an idea on how to use more efficiently the aggregate method: More specifically, I would like to calculate the mean of certain values on a data frame,? grouped by various attributes, and then create a new column in the data frame that will have the corresponding mean for every row. I attach part of my code: matchMean <-
2000 Feb 03
1
Passwords issues with samba 2.0.6
In my pursuit of integrating samba password authentication with our own stuff, I've been looking at ways on synchronizing the two. And here are the two problems for which I hope to get either solution: a) smbpasswd will not pass down spaces to whatever is called for synchronization. Barely looking at the synchronization routine, it scans as a string, which would skip anything after a space.
2007 May 23
1
Readline - wait for user input
Hi, I've seen various posts on this question, but still can't get the code right. If I run the following code one line at a time, it works fine. If I run it together as a block, however, it doesn't wait for the input and gives an error. There must be a way to have are pause/wait for an answer, but I can't seem to find it. Thanks! J Code: choosefunction <-
2010 Apr 19
2
Huge data sets and RAM problems
Dear all, This is the first time I am sending mail to the mailing list, so I hope I do not make a mistake... The last months I have been working on my MSc thesis project on performing data mining techniques on user logs of a software-as-a-service application. The main problem I am experiencing is how to process the huge amount of data. More specifically: I am using R 2.10.1 in a laptop with
2009 Dec 29
1
Effect of na.omit()
I had an NA in one row of my data frame, so I called na.omit(). But I do not understand where that row disappeared to. >fri=na.omit(fri) > fri Date.Only DAY Hour Min15 Quarter Arrival.Val Arrival4 1 09/05/2008 Friday 8 33 3 32 8 2 10/24/2008 Friday 21 86 4 28 7 3 10/31/2008 Friday 8 33 4 20
2011 Feb 09
3
Loop in variable names
Hello! I would like to do some tables for several variables and I would like to write a loop that does the table for each variable. I should also point out that my data set has several missing observations and sometimes the observations that are missing are not the same for all my variables. What I would like to do: table(StoreData$CompanyID, !is.na(StoreData$P2))
2003 Sep 15
2
Aliases for Netbios name
Hi ! Is There how I use an alias for a Samba Server ? I tried with dns alias and don't work ! i.e. Name' Samba Server is PARATY, and I'd like that the workstations could communicate with this Samba Server, but using the name SambaPDC. Is it possible ? Thanks, Bruno Stella brunostella@trt15.gov.br Setor de Redes - Secretaria de Informatica Tribunal Regional do
2005 Apr 11
2
Linux Users execute 'login scripts'
Hello ! I have a Samba Server with LDAP(OpenLDAP) authentication and Windows Workstation that login in domain working all right. Now, I need to configure Linux workstations to log in Samba Server Domain. The Linux workstatios users are all in LDAP. How do I configure to execute the 'login script' when a Linux user log in his linux workstation ? Thanks for any help ! Bruno Stella
2011 May 09
2
Creating Observation ID
If I have a data frame something like: Value=rnorm(30) Group = sample(c('A','B','C'), 30, replace=TRUE) df = data.frame(Value, Group) It seems like it should be simple to create an 'ObsID' column which indicates the observation order of each Value within each of the 3 groups. Somehow, I can't quite see how to do it without manually sub-setting the parent data