similar to: Accessing selected elements of a list

Displaying 20 results from an estimated 2000 matches similar to: "Accessing selected elements of a list"

2007 Aug 17
4
matching elements from two vectors
Hi, Imagine a vector x with elements (1,2,1,1,3,5,3,3,1) and a vector y with elements (2,3). I need to find out what elements of x match any of the elements of y. Is there a simple command that will return a vector with elements (F,T,F,F,T,F,T,T,F). Ideally, I would like a solution that works with dataframe colums as well. I have tried x==y and it doesn't work. x==any(y) doesn't work
2010 Aug 20
3
change object name within for loop
Hi, I am writing a for loop that creates one object, say 'outn' on every round of the loop. I would like the name of each object to include the index of the loop as in, for example: out1, out2, out3, ... And I would like the naming of the object to take place automatically as the loop moves through? Similarly, I would like to be able to call different objects (in1, in2, in3,
2011 Sep 08
3
Density function: Area under density plot is not equal to 1. Why?
Hi, I have a vector 'data' of 58 probability values (bounded between 0 and 1) and want to draw a probability density function of these values. For this, I used the commands: data <- runif(58) a <- density(data, from=0, to=1) plot(a, type="l",lwd=3) But then, when I try to approximate the area under the plotted curve with the command: area <- sum(a$y)*(a$x[1]-a$y[2])
2008 Mar 13
2
joining matrices, vectors, scalars in one object
Hi, I have: a <- matrix(c(0,1,0,1),nrow=2) b <- matrix(c(1,1,1,0,0,0),nrow=3) c <- 1 d <- c(1,0,1) And I would like to join them in an object 'thing' so that I can access a, b, c, or d through an index in a for loop. For example: thing[4] would return [1] 1 0 1 Note however, that I have many of these 'thing' components. So many that a command like thing
2008 Jan 27
1
calling a list element from a list name passed to a function
Hi, 'true_name' is a list of numerical, matrix, and text items I do pass_name <- "true_name" and pass the name of the list to a function so that the character class variable 'passed_name' contains the name of the list called 'true_name' Inside the function, how can I get a specified element from the list? For example, if I want to get
2007 Aug 21
2
extracting month from date in numeric form
Hi, Anyone knows what would be a short way of extracting a month from a date in numeric or integer format? months("1979-12-20") returns "December" in character format. How could I get 12 in numeric or integer format? Thanks! G. [[alternative HTML version deleted]]
2007 Aug 17
1
finding the row(s) for a date in a data frame
Hi, If I have a data frame A with the following format: Day1 Day2 Day3 Day4 1 1979-11-02 1979-11-03 1979-11-04 <NA> 2 1979-12-06 <NA> <NA> <NA> 3 1979-12-13 1979-12-14 1979-12-15 1979-12-16 4 1979-12-20 <NA> <NA> <NA> And a date "1979-12-14", for
2008 Mar 15
3
locating minimum value in matrix
Hi, I have a matrix BEE and want to find the row and column numbers of the minimum value in that matrix. The command which(BEE==min(BEE)) returns only one value which, I take, is the position of the minimum in a vector with as many elements as the matrix. Is there a quick and simple way of getting row and column numbers? Thanks, Gonçalo [[alternative HTML version deleted]]
2007 Oct 15
2
clipping off words inside a vector of strings
Hi, I have a vector of strings (class character) with 6 elements (length 6). I call it 'names'. "Graham Chapman" "John Cleese" "Terry Gilliam" "Eric Idle" "Terry Jones" "Michael Palin" And I want to turn it into another vector of strings called 'shortnames' with the same length. The new vector should look like:
2008 Aug 30
1
writing text and output to file with flexibility
Hi, I want a function to write some of its output into a text file with the following format: 'some text' output matrix A 'some more text' output matrix B 'some other text still' output matrix C ... The dimensions of matrices A, B, ... are different and the total number of matrices that I want to place in the text file depends on what I pass to the function. (I
2009 Jan 30
1
simulating outcomes - categorical distribution (?)
Hi, I am simulating an event that has 15 possible outcomes and I have a vector 'pout' that gives me the probability of each outcome - different outcomes have different probabilities. Does anyone know a simple way of simulating the outcome of my event? If my event had only two possible outcomes (0/1) I would pick a uniform random number between 0 and 1 and use it to choose between the two
2013 Nov 21
2
overlaying 2D grid on randomly distributed points
Hi, I have a cloud of randomly distributed points in 2-dimensional space and want to set up a grid, with a given grid-cell size, that minimizes the distance between my points and the grid nodes. Does anyone know of an R function or toolbox that somehow addresses this problem? This is a problem of optimizing the location of the grid, not a problem of deciding what should be the grid-cell size,
2009 Aug 21
2
2d color coded line plot
Hi! I'm not experienced very experienced with R and i'm looking for a way doing plots like in this example http://www.mathworks.de/matlabcentral/fx_files/23566/2/color_line3.png, which basically it is a 2d plot in which the 3rd dimension (variable) is color coded. I have only seen elsewhere that it is possible to color code dots in a scatter plot and I tried it with success although I
2006 Aug 07
3
RC6 startup failure: "Login prcess died too early"
Greetings. I have been running Dovecot-1.0rc2 on a test server for the last couple of weeks. No problems. However, when I installed RC6 this morning, Dovecot refused to launch completely. Here's the relevant snippet from /var/log/maillog: Aug 7 10:08:36 mercury dovecot: Dovecot v1.0.rc6 starting up Aug 7 10:08:37 mercury dovecot: Login process died too early - shutting down Aug 7
2007 Jan 16
1
number of Nodes in Random Forest
I'm calculating nodes using Random Forest in R but i only get nodes for a fraction of the compounds i want to calculate, the rest is ommited and is not printed in the output file, (i'm working with 3012 compounds). What can i do to have nodes printed for all the compounds. Thanks Gon?alo
2007 Sep 11
0
Odp: storing text and decimal values in a matrix form
Hi Gon?alo Ferraz <gferraz29 at gmail.com> napsal dne 11.09.2007 16:35:57: > Thanks! What is the easiest way of declaring an empty data frame. Is there > anything similar to: > matrix(0,x,y) > In the help files, I am only finding longer commands that ask me to specify > each individual column. You can either do dat<-data.frame(x=rep(NA,10), y=rep(NA,10)) or to
2000 Nov 19
2
bug ?
Hello, I use caldera 2.4 , and evrything goes well with samba. Login, shares, homes and neighborhood but the windows stations cannot change their samba password on the Linux serveur. It allways answers that the old password is wrong and it is no. anyway the password was recognise at the login... Their is no relation with passwd sync or passwd chat. Thank you for your help (and your work ! ).
2009 Jan 21
1
finding row and column indices of date in multiple columns of a data frame
Hi, I have a data.frame SAMPLES with columns: Site Site# Season Day1 Day2 Day3 Day1, Day2, Day3 are class "Date", the other columns are numeric or factor. I have a date "mydate" that may or may not be listed in my data.frame and I need to find that out. If "mydate" is there, I want to get the number of the data.frame row where it occurs.
2010 Dec 29
1
Script Output Format
Hi all! i'm just did a script that the output must be comma separated to be imported into a spreadsheet. the output that i obteined was Date/Time,We. Active Threads,W. Total Threads,W. Worker Threads,Name 29-12-10/11:43:01,0,250,0,/FIM ,0,/mytest ,0,/mockofprod/financing/customercentre ,0,/mockofprod/financing/commercial/amt ,0,/account/orderstatus ,0,/activities as you can see, the first
2005 Dec 17
1
lost in an ActiveRecord::StatementInvalid
I have an error I don''t know how to debug. I am adding the login suport in Depot (the example in the RoR book) and LoginController#add_user throws ActiveRecord::StatementInvalid in an innocent /login/add_user GET request. The trace goes down to a call to SQLiteAdapter#table_structure, and the source code suggests what''s happening is that "PRAGMA