similar to: Using if statement on function

Displaying 20 results from an estimated 10000 matches similar to: "Using if statement on function"

2009 Dec 20
3
How to rotate an axis?
Hi everybody, I'm trying to build a trilineare coordinate system with R. For that, I need to rotate an axis. Does anybody know, if it is possible to rotate an axis, created with the command axis(), about for instance 60 degrees? I'm looking foward to any ideas and hints and want to wish everybody a merry merry christmas. Thanks in advance. Etienne Stockhausen
2010 Jan 08
1
Using outer with function predict
Hey everybody, I have a problem with the combination of the commands outer() and predict(). I want to visualize the solutions of a regression modell in a matrix. Therefore I want to use the command predict for a linear modell as the function inside the command outer. I've made a small example: x = 1:10 y = 11:20 z = rnorm(10) lm.1 = lm(z ~ x*y)
2011 May 24
2
Problem with visualization of power of t test
Dear R-User, I'm trying to visualize the results of the power calculation with the function power.t.test(). Therefore I want to plot the related t-distributions and shade the surfaces indicatingt the type I error, the type II error and the power. For sample sizes greater 30 I got results which are very satisfying. For small sample sizes I got stuck and did'nt find a mistake. To show you
2010 Jan 18
2
permutations from vectors out of a matrix
Dear R-Users, I'm relativley new to R and have the following problem. I need all permutations of the vectors created by the collumns of a matrix. I will give a small example: p=3 n=2^p-1 #number of obtainable vectors mat=matrix(0,p,p) for(i in 1:p) { mat[i:1,i]=1/i } mat is now a
2010 Aug 09
2
How to extract the conf.level out of t.test() data
Good afternoon everybody, I'm writing a little function to visualise hypothesis testing. Therefore I need to extract the confidence level of a t-test. Here a little example: x <- str(t.test(1:10) gives List of 9 $ statistic : Named num 5.74 ..- attr(*, "names")= chr "t" $ parameter : Named num 9 ..- attr(*, "names")= chr
2011 Mar 29
1
Pictures/ Graphics in rd-files
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110329/ec6a4e5d/attachment.pl>
2010 Jan 12
2
Making routine faster by using apply instead of for-loop
Hey everybody, I have a small problem with a routine, which prepares some data for plotting. I've made a small example: c=10 mat=data.frame(matrix(1:(c*c),c,c)) row.names(mat)=seq(c,1,length=c) names(mat)=c(seq(2,c,length=c/2),seq(c,2,length=c/2)) v=as.numeric(row.names(mat)) w=as.numeric(names(mat)) for(i in 1:c) { for(j in 1:c) {
2011 Apr 27
3
median and data frames
Here are some data frames: df3.2 <- data.frame(1:3, 7:9) df4.2 <- data.frame(1:4, 7:10) df3.3 <- data.frame(1:3, 7:9, 10:12) df4.3 <- data.frame(1:4, 7:10, 10:13) df3.4 <- data.frame(1:3, 7:9, 10:12, 15:17) df4.4 <- data.frame(1:4, 7:10, 10:13, 15:18) Now here are some commands and their answers: > median(df3.2) [1] 2 8 > median(df4.2) [1] 2.5 8.5 > median(df3.3)
2010 Feb 05
2
total summary of matrix
Hi, is there a way to receive a total summary of a numerical matrix? I'm trying to get a total overview of numerical matrix. Using summary(nummat) only hands back the Min, 1st Qu, Median, Mean, 3rd Qu and Max for each column. What I actually need is all the Information for the whole matrix. Anyone an idea how to do it? Thanks in advance, -- Anne Skoeries
2009 Jun 14
6
a proposal regarding documentation
Proposal That a new mailing list be established that pertains exclusively to R documentation. The purpose of the list would be to discuss weak sections of the documentation and establish fixes for those weak spots. Pro If it works, there would be better documentation. It would be an excellent opportunity for newish and/or less technical people to contribute to R. In some respects such people
2010 Nov 08
2
Visualization of histograms
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101108/60bbf91d/attachment.pl>
2018 Oct 18
2
After updating to 16 "Some non-required modules failed to load"
I just noticed this upon startup since updating from 15.6.1 to 16.0.0 - do any of these matter? [Oct 18 12:12:18] WARNING[4489]: loader.c:2228 load_modules: Some non-required modules failed to load. [Oct 18 12:12:18] ERROR[4489]: loader.c:2243 load_modules: res_pjsip_transport_websocket declined to load. [Oct 18 12:12:18] ERROR[4489]: loader.c:2243 load_modules: cdr_sqlite3_custom declined to
2010 Feb 18
3
row indexes from logical statment
Is there any easy way to pull out the row indexes for a logical matching statment? #################example code######################################### foo <- data.frame(name=c(rep("A", 25), rep("B", 25), rep("C", 25), rep("A", 25)), stuff=rnorm(100), and=rnorm(100), things=rnorm(100)) #this is what I want but I would like the row indexes
2008 Oct 23
15
VEC Operator in R
Can anyone please tell whether there is any R function to act as "VEC" and "VECH" operator on Matrix? Yes of course, I can write a user-defined-function for that or else, I can put dim(mat) <- NULL. However I am looking for some R function. Your help will be highly appreciated. Regards, -- View this message in context:
2011 Dec 23
3
if statement problem
Hello, I want to do fisher test for the rows in data file which has value less than 5 otherwise chi square test .The p values from both test should be stored in one resulted file. but there is some problem with bold if statement. I don't know how implement this line properly. x = cbind(obs1,obs2,exp1,exp2) a = matrix(c(0,0,0,0), ncol=2, byrow =TRUE) #matrix with initialized values
2013 Feb 28
2
Fortune?
I think the rule is that you can do anything as long as you don't complain. If you want to complain, you must follow the instructions. -- Jari Oksanen in Re: [Rd] Keeping up to date with R-devel -- Patrick Burns pburns at pburns.seanet.com twitter: @burnsstat @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of: 'Impatient R' 'The R
2006 Nov 09
2
Retrieving function name
Hi, Does anyone know how I can retrieve a function name, for example If I have a function f as follows: f <- function( myfunc ) { print( name_of(myfunc) ); } I want to know what I should have as "name_of" such that I could call this with : f( median ) and it would print "median" or f( my_function_name ) and it would print "m_function_name". So far all I
2010 May 30
4
Data Frame as Hash Table
I'm interested in using a data frame as if it were a hash table. For instance if I had the following, > (d <- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6))) key value 1 0.5 -1.118665122 2 1.0 0.465122921 3 1.5 -0.529239211 4 2.0 -0.147324638 5 2.5 -1.531503795 6 3.0 -0.002720434 Then I'd like to be able to quickly retrieve the "value" of "key" 1.5
2011 Sep 12
3
Solve your R problems
R-help is all about solving R problems. So here ya go: http://www.portfolioprobe.com/2011/09/12/solve-your-r-problems/ -- Patrick Burns pburns at pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno')
2010 Feb 25
24
two questions for R beginners
* What were your biggest misconceptions or stumbling blocks to getting up and running with R? * What documents helped you the most in this initial phase? I especially want to hear from people who are lazy and impatient. Feel free to write to me off-list. Definitely write off-list if you are just confirming what has been said on-list. -- Patrick Burns pburns at pburns.seanet.com