similar to: trouble with ifelse statement

Displaying 20 results from an estimated 8000 matches similar to: "trouble with ifelse statement"

2023 Jan 30
2
question
Hi guys, I am using the cor() function to see if there are correlations between March cortisol levels and December cortisol levels and I'm trying to figure out if the function is doing what I want it to do. Each sample has it's own separate row in the CSV file that I'm working out of. March Cort and December Cort are different columns and they come from separate samples, therefore
2012 Apr 23
2
plot function creating bars instead of lines
Hello, I am having a problem where code that plots lines using a different data frame plots bars with the current data frame (I am intended to plot lines). The code specifies lines (see below), so I can't figure out why the results are bars. I suspect that it may have something to do with the fact that in the data frame where the code worked as intended, the both variables specifying
2012 Mar 19
2
by output into data frame
I could do this in various hacky ways, but what's the right way? I have a nice application of the by function, which does what I want. The output looks like this: > auc_stress lab.samples.stress$subid: 2 cortisol amylase 1 919.05 6834.8 ---------------------------------------------------------------------------------------------------------------------------
2005 Nov 21
1
(no subject)
Hi, I have written the following function to check whether a vector has elements satisfying monotonicity. is.monotone <- function(vec, increase=T){ # check for monotonicity in time-stamp data for cortisol collection ans <- TRUE vec.nomis <- vec[!is.na(vec)] if (increase & any(diff(vec.nomis,1) < 0, na.rm=T)) ans <- FALSE if (!increase & any(diff(vec.nomis,1) > 0,
2011 Sep 28
3
Plotting Lines Through multiple groups
Hi I have data in the following format Cort Day Animal 23 0 1 27 3 1 24 0 2 27 1 2 34 2 2 30 3 2 24 4 2 20 0 3 24 1 3 28 2 3 34 4 3 etc. It is measured across time(day) however no every individual is measured the same number of times. All I want to do is plot the Raw data and then run a line connecting the
2013 Nov 04
1
Access denied when associating a driver with a printer
Hi, I'm trying to get point & print working against a 4.0.10 Samba server (using the sernet packages if that's relevant). I have the printer itself setup and I've uploaded the driver, but associating the uploaded driver with the printer causes Windows to give an error: "Printer settings could not be saved. Access is denied". I'm seeing the same symptoms on XP and
2013 Apr 27
3
path reference problems in R 3.0.0
Hi- I just upgraded R to 3.0.0 from 2.15.1 (which worked fine). When I started trying to install updated versions of the libraries, I saw the following error: > install.packages("lme4") Installing package into 'c:/Docume~1/melissa/R/win-library/3.0' (as 'lib' is unspecified) Warning in install.packages :
2006 Feb 28
3
Agile Web Development Example Application Question
I''m new to Ruby and to fairly new to programming. I''ve been working through the "Agile Web Development with Rails" book, and I''m stuck on page 73 of the print version. The book''s online errata directed me here with my questions. I''m running Ruby 1.8.3 with MySQL 4.1.8 on OSX 10.3.9. I''ve created the scaffolding for Admin controller
2012 Apr 21
2
using "factor" to eliminate unused levels without dropping other variables
Hello, I have been banging my head against the wall trying to figure out this seemingly simple problem with no success. I'm hoping that one or some of you can help. Here is the code I am trying to use: #importing data data.file <-read.csv("/file/location", header=TRUE, sep = ",") #selecting a subset of data based on variable "Sample" data.subset1 <-
2010 Nov 29
3
Help Please!!!!!!!!!
Hi, I have been working with Program R for my stats class and I keep coming upon the same error, I have read so many sites about inputting data from a text file into R and I'm using the data to do a correspondence analysis. I feel like I have read everything and it is still not explaining why the error message keeps coming up, I have used the exact examples I have seen in articles and the
2006 Jan 05
1
Account Unknown for users with Samba 3.0.11/14
Hi, I've got a problem with a samba server I inherited which I can't solve. I think it's the configuration rather than the version because I have the same problem with a 3.0.14 and a 3.0.11 Samba server with almost identical configurations. Both authenticate against LDAP, one has an old smbpasswd file which should no longer be in use. The issue is that when I click
2012 Jan 28
2
finding rows in a matrix that match a vector
Hi, Please excuse my ignorance, but I am just learning R (this is my very first day programming in R) and having a really hard time figuring out how to do the following: I have a matrix that is 1000 row by 6 columns (named 'table.combos') and a 1 row by 6 column vector (named 'mine'). I want to find every row in 'table.combos' that equals 'mine' and then count
2010 Jul 07
1
ifelse statement
Hi, I am a newbie of R, and playing with the "ifelse" statement. I have the following codes: ## first, for(i in 1:3) { for(j in 2:4) { cor.temp <- cor(iris.allnum[,i], iris.allnum[,j]) if(i==1 & j==2) corr.iris <- cor.temp else corr.iris <- c(corr.iris, cor.temp) } } this code is working fine. I also tried to perform the same thing in another way with "ifelse":
2011 Jul 11
1
Ifelse statement
Hello everyone, I have a (small) issue. I already googled a lot, so I decided to use ifelse instead of if (){} else{} All the elements seem to work seperately, but combined in the ifelse statement, it doesn't seem to work. #The price function is a function which is normally distributed with only positive answers price<-function() {abs(rnorm(1,10,25))} #Before I use pieceprice in the
2005 Dec 13
2
creating a subset of a dataset using ifelse statement?
I am using R in a Microsoft Windows environment. I have a dataset called “mp1b”. I have a variable called h. h can take a value from -1 to 5. If h <1, I want to create a new dataset called mp2 that is the same as mp1b: “mp2<-mp1b” If h > 0, I want to set create a dataset mp2, where I limit the original dataset to those where mp1b$group = =h. similar to:
2010 Sep 17
1
ifelse statement
Dear list, I have a question I'm trying to use the following command in R, but it gives me an error message.The command is: data<-ddply(data,c("year","name"), transform, check1=ifelse(check1==1 & check2==1, 1,NULL)) so in my data frame I already have the check1 variable, if the conditions (check1==1 & check2==1) is respected, check has to have 1 as value,
2007 Dec 13
3
what does cut(data, breaks=n) actually do?
Hello, I'm trying to bin a quantity into 2-3 bins for calculating entropy and mutual information. One of the approaches I'm exploring is the cut() function, which is what the mutualInfo function in binDist uses. When it's called in the format cut(data, breaks=n), it somehow splits the data into n distinct bins. Can anyone tell me how cut() decides where to cut? Thanks, Melissa
2010 Jul 21
1
xtable with ifelse statement
Hi there, I'm very new on R and I hope someone can help me to solve the problem in using the ifelse statement with the xtable function(library xtable). I'm trying to get the printing of the elements of two lists in a sorted way. These two list have in common the their names. I will try to give an example: the first list looks like this: $code1 Code code1 Nation
2005 Jun 22
2
Trouble with ifelse and if statement (PR#7962)
Full_Name: Woolton Lee Version: 2.1 OS: windows Submission from: (NULL) (128.118.224.46) I did the following ('g' and 'h' are both numeric vectors) > i <- abs(g-h) creating a vector 'i' with values, > i [1] 0.08 0.00 0.33 0.00 0.00 0.00 0.00 0.33 0.00 0.00 0.08 0.08 0.20 0.00 0.13 Now, I want to create a new vector =1 whenever 'i' = 0.33 and =0
2008 Mar 05
1
FOR LOOP w/IFELSE statement help
Dear list, I'm trying to query a string of numbers to identify where in the string the numbers stop increasing (where x[i] == x[i+1]). In example 1 below, I've adapted code from Jim Holt to do this. However, I run into situations where the condition is not met, as in example 2, where the number string is continuous. In this case, I need to specify an alternative outcome, where if in the