similar to: A kind of set operation in R

Displaying 20 results from an estimated 9000 matches similar to: "A kind of set operation in R"

2012 Aug 20
5
Some kind of inverse of "names"
I wonder if there exists some kind of inverse of the "names" primitive in R. Let me explain what do I mean: If I create a list: -> li <- list(a=1, b=2, c=3, d=4) then I can have: -> names(li) [1] "a" "b" "c" "d" which is, I guess, some kind of vector, since -> typeof(names(li)) [1] "character" however, I haven't
2013 Apr 16
6
I don't understand the 'order' function
I thought I've understood the 'order' function, using simple examples like: order(c(5,4,-2)) [1] 3 2 1 However, I arrived to the following example: order(c(2465, 2255, 2085, 1545, 1335, 1210, 920, 210, 210, 505, 1045)) [1] 8 9 10 7 11 6 5 4 3 2 1 and I was completely perplexed! Shouldn't the output vector be 11 10 9 8 7 6 4 1 2 3 5 ? Do I have a damaged
2012 Mar 09
3
Interacting with the Operating System
Is there any way to issue operating system commands and geting back the results, in R? I mean, for instance, in Linux, to execute from R the 'ls' command and getting back a list of files in the current directory, or, equivalently, in Windows/DOS, the 'dir' command? I'm not interested in the 'ls' or 'dir' commands it is just an example. Do you have any
2013 Feb 26
3
Merging value labels into indicator variable.
I have a vaiable named NAM having value : 1,2,3,4,5,6,7,8,9. I want to make an indicator variable that will take value 1 if NAM=7 or NAM=8 or NAM=9. How can I do that? I usually do: Var001<- ifelse(NAM==7,1,0) for the simplest case. [[alternative HTML version deleted]]
2013 Dec 06
2
Using assign with mapply
I have a data frame whose first colum contains the names of the variables and whose second colum contains the values to assign to them: : kkk <- data.frame(vars=c("var1", "var2", "var3"), vals=c(10, 20, 30), stringsAsFactors=F) If I do : assign(kkk$vars[1], kkk$vals[1]) it works : var1 [1] 10 However, if I try with mapply
2017 May 10
3
registering Fortran routines in R packages
Thanks for your email. I try to change the name in lowercase but it conflicts with a C implementation also named halton. So I rename the C function halton2() and sobol2() while the Fortran function are HALTON() and SOBOL() (I also try lower case in the Fortran code). Unfortunately, it does not help since I get init.c:97:25: error: use of undeclared identifier 'halton_'; did you mean
2017 Dec 14
3
Errors in reading in txt files
On Thu, Dec 14, 2017 at 1:58 PM, Berend Hasselman <bhh at xs4all.nl> wrote: > >> On 14 Dec 2017, at 19:36, lily li <chocold12 at gmail.com> wrote: >> >> Hi R users, >> >> I have a question about reading from text files. The file has the structure >> below: >> >> Time Column1 Column2 >>
2017 Sep 24
2
gsDesign Pocock & OBF boundary
Sorry for messed up text. Here it goes again: I am learning to use the gsDesign package. I have a question about Pocock and OBF boundary. As far as I can understand, these 2 boundaries require equal spacing between interim analyses (maybe this is not correct?). But looks like I can still use gsDesign to run an analysis based on unequal spacing:? >
2019 Feb 06
2
nlminb with constraints failing on some platforms
> On 6 Feb 2019, at 10:58, Martin Maechler <maechler at stat.math.ethz.ch> wrote: > ..... > --------------------------------------------------------------------------- > > I summarize what has been reported till: > > Failure in these cases > ======== > 1. Kasper K ("Scientific Linux", self compiled R, using Intel's MKL > for BLAS/LAPACK)
2017 Sep 16
2
require help
You can just use the same code that I provided before but now use your dataset. Like this df <- read.csv(file="data2.csv",header=TRUE) dates <- as.Date(paste(df$year,"-01-01",sep="")) myXts <- xts(df,order.by=dates) head(myXts) #The last command "head(myXts)" shows you the first few rows of the xts object year cnsm incm wlth
2017 Dec 14
0
Errors in reading in txt files
> On 14 Dec 2017, at 19:36, lily li <chocold12 at gmail.com> wrote: > > Hi R users, > > I have a question about reading from text files. The file has the structure > below: > > Time Column1 Column2 > 01.01.2001-12:00:00 This line does not contain 3 elements; only one. You'll have to fix that line. Delete it, prepend it with a
2010 Mar 10
4
write.fortran
Dear all, I'm trying to write tabular data to a text file, these data will be the input of a Fortran program. The format needs to be "(i7,2x,7(e15.7,2x))". I have not been able to find a clean way of producing this output with write.table. I searched for a "write.fortran" function similar to read.fortran() in package utils but I couldn't find any. Below is a small
2013 Jun 19
2
Problems in Constructing Two way Matrix
Hello, Where is the problem in this programming. I want two way matrix, but it gives problem. The program is given below: Thanks in advance. Regards Fazli Raziq rep = 2 genes = 5 pred = c() iter   = array (dim = c(rep, pred)) pred = array(dim = c(1, genes)) m = c() l = 1 w = 1 for(m in 1:rep) { t = time c = cens tab = cbind(t, c) # Resampling Time and Censoring cc = sample(c, replace = TRUE)
2017 Dec 14
3
Errors in reading in txt files
Hi R users, I have a question about reading from text files. The file has the structure below: Time Column1 Column2 01.01.2001-12:00:00 01.01.2001-24:00:00 12 11 01.02.2001-12:00:00 13 10 01.02.2001-24:00:00 11 12 01.03.2001-12:00:00 15 11 01.03.2001-24:00:00 16 10 ... I
2017 Sep 15
7
require help
hello to all. I am working on macroeconomic data series of India, which in a yearly basis. I am unable to convert my data frame into time series. kindly help me. also using zoo and xts packages. but they take only monthly observations. 'data.frame': 30 obs. of 4 variables: $ year: int 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ... $ cnsm: num 174 175 175 172 173 ... $ incm:
2012 Mar 30
4
Trying to understand factors
I'm trying to figure out about factors, however the on-line documentation is rather sparse. I guess, factors are intended for grouping arrays members into categories, which R names "Levels". And so we have: * state <- c("tas", "sa", "qld", "nsw", "nsw", "nt", "wa", "wa",
2016 Oct 26
3
BUG?: On Linux setTimeLimit() fails to propagate timeout error when it occurs (works on Windows)
Thank you for the feedback and confirmations. Interesting to see that it's also reproducible on macOS expect for Spencer; that might indicate a difference in builds. BTW, my original post suggested that timeout error was for sure detected while running Sys.sleep(10). However, it could of course also be that it is only detected after it finishes. For troubleshooting, the
2012 Sep 12
4
Trying to use pipes in R
Hi, I'm trying to use pipes in R. By now, I could launch the linux command "wc" (to count words from a text), but I don't know how to capture the results, say in a vector of chars... Here is the R code I'm trying: :> f <- pipe("wc", open="w") :> writeLines(c("uno dos tres", "cuatro cinco", "seis"), f) :> close(f)
2017 Sep 24
0
gsDesign Pocock & OBF boundary
Still failed. The first secret is in your email program settings, to use Plain Text format (at least for emails you send to this mailing list). The second secret tool to use is the reprex package to let you verify that your code example will do on our computers what it is doing on your computer before you send it to us. That will also involve giving us some sample data or referencing some data
2012 Aug 24
5
include dll in R-package
Hi, We have several projects in the center done by researchers over years in Fortran, there are copy right issues etc to prevent us from giving away the source codes, but a lot of social scientist are interested to use the program. We tried to use dlls to make plugins (available in our website) in various statistics platforms (SAS, STATA and R) to make it available to general public. We used