similar to: R conditional matrix operations - advanced condition

Displaying 20 results from an estimated 4000 matches similar to: "R conditional matrix operations - advanced condition"

2012 Jun 07
1
select subrows based on a specific column in a matrix
Hi all, I have a matrix with 10000 rows and 10 columns. The last columns contains another identifiers but the values are not uniques so that I want to generate another matrix with rows with unique values in the last column. If I did tmp<-unique(my_mat$col10) this will give me 8560 unique entries so the ideal matrix will be 8560X10 columns now then. I tried sub_mat<-my_mat[tmp,] but
2011 Mar 14
3
increase a value by each group?
Hi everybody. I'm looking for the way to increase the depth value in 0.01 for each index group. Easier to explain with this example: >my_data=read.table("clipboard", header=TRUE) Depth s_name index 3852 Site_1 144 3852 Site_1 144 3852 Site_1 144 3852 site_A 145 3852 site_A 145 3852 site_A 145 3852 site_A 145 3852 site_B 147 3852 site_B 147 3852 site_B 147 3852 site_B 147 54962
2013 Jan 17
3
how to use "..."
Dear users, I'm trying to learn how to use the "...". I have written a function (simplified here) that uses doBy::summaryBy(): # 'dat' is a data.frame from which the aggregation is computed # 'vec_cat' is a integer vector defining which columns of the data.frame should be use on the right side of the formula # 'stat_fun' is the function that will be run to
2006 Dec 28
2
lattice xyplot: plot multiple lines with different colors
Hi everyone, I am using the lattice package to plot some simulation results, by using the function xyplot(). However, I cannot find a way to plot multiple lines within the same xyplot and to have each of the lines be drawn in a different color. This is what I am currently doing: xyplot(a + b + c ~ x, my_data, panel = panel.lines) but, of course, all lines are drawn in the same color. What
2011 Dec 27
1
How to extract an interval of "hour:minute" type
Hi, I 'd like to know how to extract an interval of "hour:minute" type from a column of POSIXlt POSIXct type. For instance: my_data.csv: 4352;2011-09-02 21:30:00;3242; 4352;2011-09-02 21:31:00;3315; 4352;2011-09-02 21:32:00;4241; 4352;2011-09-02 21:33:00;5394; ... 4352;2011-09-02 01:02:00;67; 4352;2011-09-02 01:03:00;67; 4352;2011-09-02 01:04:00;67; .... I loaded
2012 Aug 04
1
Getting unknown error trying to plot spatial data
Hi there! I'm following an awesome guide to working with spatial data (http://www.frankdavenport.com/blog/2012/6/19/notes-from-a-recent-spatial-r-class-i-gave.html) and am running into an error that I can't figure out how to fix. Disclaimer: I am very much an R n00b Here is the r script I am running: https://dl.dropbox.com/u/28231177/This%20Should%20Work.R data:
2024 Feb 24
1
Interactions in regression
Hi All, I stumbled upon some topics regarding interactions in anova and regression and packages for tabulating and visualizations the results of them. Here we are: https://stackoverflow.com/questions/77933272/how-to-add-a-reference-level-for-interaction-in-gtsummary-and-sjplot/77935742#77935742 ,
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
On 8/13/19 5:36 PM, Richard W.M. Jones wrote: > The definition of functions that take a callback is changed so that > the callback and user_data are combined into a single structure, eg: > > int64_t nbd_aio_pread (struct nbd_handle *h, > void *buf, size_t count, uint64_t offset, > - int (*completion_callback) (/*..*/), void *user_data, > +
2018 May 10
4
the first name of the first column
Dear all; I need to run heatmap. Because my first column in my data is alphanumeric, I can not run as.matrix(scale(my_data)). So I need to make my data readable as in data(mtcars). In *mtcars *data the first column is alphanumeric and has no name. Thanks, Greg [[alternative HTML version deleted]]
2024 Feb 25
1
Interactions in regression
It is trivial in R to add whatever decorations to a plot that you would like, but that requires that you go beyond point and click production of graphics and write actual code. If you are unwilling or unable to do this, you are stuck with whatever various packaged graphics functionality provides.So you might want to search on "interaction plots for linear models in R" or similar at
2007 Jan 30
3
How to find series of small numbers in a big vector?
Hello: I have a vector with 120,000 reals between 0.00000 and 0.9999 They are not sorted but the vector index is the time-order of my measurements, and therefore cannot be lost. How do I use R to find the starting and ending index of ANY and ALL the "series" or "sequences" in that vector where ever there are 5 or more members in a row between 0.021 and 0.029 ? For
2018 Apr 13
0
Fwd: R Timeseries tsoutliers:tso
Hello, Writing to seek help in regard to some unexpected performance anomaly i am observing in using tsoutlers:tso on the mac vs on an AWS cloud server.. I am running the following code with very small dataset of about 208 records. d.dir <- '/Users/darshanpandya/xxxxxx' FNAME <- 'my_data.csv' d.input <- fread(file.path(paste0(d.dir,"/zzz/"),FNAME,fsep =
2012 Mar 14
1
Questing on fitting Baseline category Logit model
Dear all, I am facing some problem with how to fit a "Baseline category Logit model" with R. Basically I am considering famous "Alligator" data as discussed by Agresti. This data can also be found here: https://onlinecourses.science.psu.edu/stat504/node/174 (there is also an accompanying R file, however the underlying R code could not load the data properly!!!) Below are
2009 Sep 02
1
Problems with Boxplot
Hello, I have been having difficulty getting boxplot to give the output I want - probably a result of the way I have been handling the data. The data is arranged in columns: each date has two sets of data. The number of data points varies with the date, so each column is of different length. I want to get a series of boxplots with the date along the x-axis, with alternating colors, so that it
2013 Feb 19
3
R nls results different from those of Excel ??
Hi all I have a set of data whose scatter plot shows a very nice power relationship. My problem is when I fit a Power Trend Line in an Excel spreadsheet, I get the model y= 44.23x^2.06 with an R square value of 0.72. Now, if I input the same data into R and use model< -nls(y~ a*x^b , trace=TRUE, data= my_data, start = c(a=40, b=2)) I get a solution with a = 246.29 and b = 1.51. I have tried
2018 Apr 12
2
R Timeseries tsoutliers:tso
Hello, Writing to seek help in regard to some unexpected performance anomaly i am observing in using tsoutlers:tso on the mac vs on an AWS cloud server.. I am running the following code with very small dataset of about 208 records. d.dir <- '/Users/darshanpandya/xxxxxx' FNAME <- 'my_data.csv' d.input <- fread(file.path(paste0(d.dir,"/zzz/"),FNAME,fsep =
2008 Aug 11
1
line with of the symbols in the legend -- changable?
Dear R users, I plot data with points(my_data[x]~x, col = x, type = "o", lwd="4") where x is an integer running from 1 to 10, I get points drawn at the plot. When want to do a legend to this I try legend(leg.txt[x], col = x, text.col = 1, pch = 1, bty = "n") where leg.txt contains the names of the variable and x behaves the same. The difference between the
2009 Apr 23
1
suppress output from step function
Dear all, Is there a way of using the step function on a linear model such that all the steps are not printed out? Say I have a matrix X of 50 explanatory variables and a binary response Y. linear_model<-glm(Y~X, data=my_data, family="binomial") SS<-step(linear_model) This last step produces all the output that would have been produced even if I hadn't named the result SS.
2009 Oct 16
1
Converting dataframe to matrix
Hi, I'm experimenting with a few learners that require a matrix as their input. (Currently svmpath, vbmp, etc.) I currently have a dataframe with 50 columns and 20,000 rows. I tried using: x <- as.matrix(my_data.frame) If I then as, "is.matrix(x)", I get TRUE. However everywhere I've tried to use the matrix returns errors. Is there a step I'm missing? Thanks! -N
2008 Sep 16
2
Setting user colors in barchart
Dear R Users, I have a basis question regarding the use of color in the lattice package. I read the ?barchart help page and searched the R archives but could not understand how to do it. I just need to plot a barchart using specific colors for my groups, e.g. green and red instead of the default lattice colors. How do I do that? If I say: barchart(x ~ a_factor, groups=my_groups,