similar to: R on Multi Core

Displaying 20 results from an estimated 5000 matches similar to: "R on Multi Core"

2010 Jun 01
4
Plot multiple columns
I'm running a long MCMC chain that is generating samples for 22 variables. I have each run of the chain as a row in a matrix. So: Chain[,1] is the column with all the samples for variable one. Chain[,2] is the column with all the samples for variable 2, etc. I'd like to fit all 22 on a single page to print a nice summary. It is OK if the graphs are small, I just need to show the
2011 Mar 31
3
Create Variable names dynamically
Hi, I want to create variable names from within my code, but can't find any documentation for this. An example is probably the best way to illustrate. I am reading data in from a file, doing a bunch of stuff, and want to generate variables with my output. (I could make a "list of lists" and name all the elements, but I really want separate variables.) ################# #This is
2009 Oct 16
2
Different way of scaling data
Hi, I have a data.frame that I need to scale. I've been using the scale function and it works nicely. Some of the libraries I'm testing won't accept negative values for data, so I need to find a way to scale the data from 0 to 1 Any ideas? Thans!
2009 Aug 30
3
Sapply
Hi, I need a bit of guidance with the sapply function. I've read the help page, but am still a bit unsure how to use it. I have a large data frame with about 100 columns and 30,000 rows. One of the columns is "group" of which there are about 2,000 distinct "groups". I want to normalize (sum to 1) one of my variables per-group. Normally, I would just write a huge
2009 Sep 22
2
Pull Coefficients from MCMCpack models
Hi, I've been testing some models with the MCMCpack library. I can run the process and get a nice model "object". I can easily see the summary and even plot it. I can't seem to figure out how to: 1) Access the final coefficients in the model 2) Turn the coefficients into a model so I can then run predictions using them. A summary command will SHOW Me the coefficients, but
2009 Sep 07
2
Confused - better empirical results with error in data
Hi, I have a strange one for the group. We have a system that predicts probabilities using a fairly standard svm (e1017). We are looking at probabilities of a binary outcome. The input data is generated by a perl script that calculates a bunch of things, fetches data from a database, etc. We train the system on 30,000 examples and then test the system on an unseen set of 5,000 records.
2010 Jul 09
3
accessing return variables from a function
Hi, I am trying to figure out a "short" way to access two values output from the sort function. >x <- c(3,4,3,6,78,3,1,2) >sort(x, index.return=T) $x [1] 1 2 3 3 3 4 6 78 $ix [1] 7 8 1 3 6 2 4 5 It would be great to do something like this (doesn't work.): c(y, indexes) <- sort(x, index.return=T) But that doesn't work. I CAN grab the output of sort in a
2009 Sep 03
2
Easy way to get top 2 items from vector
Hi, I use the max function often to find the top value from a matrix or column of a data.frame. Now I'm looking to find the top 2 (or three) values from my data. I know that I could sort the list and then access the first two items, but that seems like the "long way". Is there some way to access "max_2" or similar? Thanks! -- Noah
2010 May 15
3
Discretize factors?
Hi, I'm looking for an easy way to discretize factors in R I've noticed that the lm function does this automatically with a nice result. If I have group <- c("A", "B","B","C","C","C") and run: lm(result ~ x1 + group) The lm function has split the group into separate binary variables {0,1} before performing the
2009 Aug 26
6
Managing output
Hi, Is there a way to build up a vector, item by item. In perl, we can "push" an item onto an array. How can we can do this in R? I have a loop that generates values as it goes. I want to end up with a vector of all the loop results. In perl it woud be: for(item in list){ result <- 2*item^2 (Or whatever formula, this is just a pseudo example) Push(@result_list,
2009 Jul 22
5
Find multiple elements in a vector
Hi, Given a vector, say x=sample(0:9,10) x [1] 0 6 3 5 1 9 7 4 8 2 I can find the location of an element by which(x==2) [1] 10 but what if I want to find the location of more than one number? I could do c(which(x==2),which(x==3)) but isn't there something more streamlined? My first guess was y=c(2,3) which(x==y) integer(0) which doesn't work. I haven't found any clue in the R
2010 Feb 28
2
lapply with data frame
I'm a bit confused on how to use lapply with a data.frame. For example. lapply(data, function(x) print(x)) WHAT exactly is passed to the function. Is it each ROW in the data frame, one by one, or each column, or the entire frame in one shot? What I want to do apply a function to each row in the data frame. Is lapply the right way. A second application is to normalize a column value by
2010 May 12
3
Summarizing counts by multiple factors
Hi, An example data set is: group level color A 1 "blue" A 1 "Red" B 1 "blue" B 2 "Red" A 2 "Red" B 2 "Red" B 2 "blue" B 2 "blue" A 2 "blue" A 2 "Red"
2009 Jul 14
5
Nested for loops
Hi, I have spent some time locating a quite subtle (at least in my opinion) bug in my code. I want two nested for loops traversing the above-diagonal part of a square matrix. In pseudo code it would something like for i = 1 to 10 { for j = i+1 to 10 { // do something } } However, trying to do the same in R, my first try was for (i in 1:10) { for (j in (i+1):10) { //
2009 Sep 17
3
How to generate a matrix where each row (or column) is the same vector?
Hi, I can use the following code to generate a matrix, each column of which is 'x'. But I have to specify '5' twice in the second command. I am wondering if there is a better way to do it. > x=1:10 > matrix(rep(x,5),nc=5) > t(matrix(rep(x,5),nc=5)) Regards, Peng
2009 Sep 03
2
[OT] book on Linux scripting
Dear R People: I know that this is off topic, but could anyone recommend a good book on Linux scripting please? Any help would be much appreciated! Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodgess at gmail.com
2009 Jul 20
5
heatmap plot
Dear R community! I am trying to create a heatmap based on the following data. As you can see the diagonal (0,0 to 10,10) is always 0). If I run the heatmap command like i posted it I get a graph with horizontal lines. What is my mistake? > heatmap(activity.matrix, Rowv = NA, Colv = NA, scale="column", xlab="x Compounds", ylab="y Compounds",
2009 Aug 02
2
Strange column shifting with read.table
Hi, I am reading in a dataframe from a CSV file. It has 70 columns. I do not have any kind of unique "row id". rawdata <- read.table("r_work/train_data.csv", header=T, sep=",", na.strings=0) When training an svm, I keep getting an error So, as an experiment, I wrote the data back out to a new file so that I could see what the svm function sees.
2010 Mar 19
2
Factor variables with GAM models
I'm just starting to learn about GAM models. When using the lm function in R, any factors I have in my data set are automatically converted into a series of binomial variables. For example, if I have a data.frame with a column named color and values "red", "green", "blue". The lm function automatically replaces it with 3 variables colorred, colorgreen,
2010 May 31
4
Fancy Page layout
Hi, Working on a report that is going to have a large number of graphs and summaries. We have 80 "groups" with 20 variables each. Ideally, I'd like to produce ONE page for each group. It would have two columns of 10 graphs and then the 5 number summary of the variables at the bottom. So, perhaps the top 2/3 of the page has the graphs and the bottom third has 20 rows of data