Displaying 20 results from an estimated 10000 matches similar to: "accessing return variables from a function"
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 Sep 11
4
R on Multi Core
Hi,
Our discussions about 64 bit R has led me to another thought.
I have a nice dual core 3.0 chip inside my Linux Box (Running Fedora 11.)
Is there a version of R that would take advantage of BOTH cores??
(Watching my system performance meter now is interesting, Running R will
hold a single core at 100% perfectly, but the other core sites idle.)
Thanks!
--
Noah
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.
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 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,
2011 Oct 24
1
Plot unusual subset of data
Hi,
I have a function that approximates some data and indicates "segments".
I'd like to plot the original data, and then the linear approximations on top of it. (Ideally, just a subset of N rows at a time, as the data set is large.)
I can't figure out a clean way to do this. Suggestions?
here is some sample data:
==================================
Row X Seg
?.
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,
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 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 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 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
2011 Jan 07
2
Stepwise SVM Variable selection
I have a data set with about 30,000 training cases and 103 variable.
I've trained an SVM (using the e1071 package) for a binary classifier
{0,1}. The accuracy isn't great.
I used a grid search over the C and G parameters with an RBF kernel to
find the best settings.
I remember that for least squares, R has a nice stepwise function that
will try combining subsets of variables to find
2010 Nov 11
1
Populating then sorting a matrix and/or data.frame
Hi,
I have a process in R that produces a lot of output. My plan was to
build up a matrix or data.frame "row by row", so that I'll have a nice
object with all the resulting data.
I started with:
results <- matrix(ncol=3)
names(results) <- c("one", "two", "three")
Then, when looping through the data:
results <- rbind(results, c(a,b,c))
2009 Aug 04
1
Build a dataframe row by row?
Hi,
Time for another of my "newbie" questions.
Is it possible to build up a data.frame "row by row" as I go
I'm going to be running a bunch of experiments (many in a loop) to test
different things. I'm using AUC as my main performance measure.
My thought was to add a row to a data.frame for each iteration and then
have a nice summary report at the end.
I found
2010 May 30
1
Building a list
Hello,
I need to build a "list of lists"
We have 20 groups we are generating MCMC samples for. There are 10
coefficients, and 10000 MCMC iterations.
I would like to store each iteration by-group in a list. My problem is
with the first iteration.
Here is a toy example:
Chain <- list()
for (j in 1:10000){
coef <- c(1,2,3,4,5,6,7,8,9,10) #would be actual MCMC samples