similar to: The elegant way to test if a number is a whole number

Displaying 20 results from an estimated 10000 matches similar to: "The elegant way to test if a number is a whole number"

2011 Jul 06
1
elegant way of removing NA's and selecting specific values from a data.frame
I have a data.frame "e" and would like to extract the 23rd column, remove any NA's and then remove any values >= 30. I can do it in steps such as this but have failed to figure out how to do it in a single line .... any suggestions? first <- e[,23] second <- first[!is.na(first)] third <- second[second<=30] thanks a bunch J -- Dr. Jim Maas University of East
2011 Oct 11
2
replicate data.frame n times
Hi, is there a way to replicate a data.frame like you can replicate the entries of a vector (with the repeat-function)? I want to do this: x <- data.frame(x, x) (where x is a data.frame). but n times. And it should be as cpu / memory efficient as possible, since n is pretty big in my case. thanks for any suggestions!
2011 Jul 26
5
Help with boxplot
Hi guys, I need your help with the boxplot. I've to create a boxplot starting from a table (.csv) in which there are the result of a test. Each column is a question and the rows are the answer of the respondents (from 0 to 5). Some answer is missing and has been filled with NA. the table has been loaded in R with the function read.csv I created the boxplot with the function boxplot and all
2011 Sep 19
1
Constrained regressions (suggestions welcome)
All, Could anyone recommend a package that allows the user to constrain the coefficients from a multiple regression equation? I tried using the gl1ce function in lasso2, but couldn't get it to work. I created a contrived example to illustrate my starting point. data(cars) fmla <- formula(dist ~ speed) gl1c.E <- gl1ce(fmla, data = cars) gl1c.E gl1c.E <- gl1ce(fmla, data =
2011 Jul 05
4
if else lop
I am trying to use if...else loop and have included a code snippet which I might like to expand. Maybe you could steer me in the right direction. library(stats) library(prob) { a <- sample ( 1:4,100, replace=T,prob=c(0.1,0.2,0.5,0.3)) b<-sample(3:6,100,replace=T,prob=c(0.2,0.2,0.2,0.4)) } dd <- data.frame(a,b) if (subset finds a vector) ( print that vector) (else
2011 Aug 15
2
what can one do with (to) '..." ?
I followed a couple threads from the archives and from stackoverflow.com, and would like to know: just what is "..." ? What I mean by this is,for example, from the point of view of a user running a function in debug mode, is "..." an object, or does it exist in the current environment as some thingy? Maybe a better question to ask is: if I were to write some function
2011 Sep 20
4
open source editor for r for beginners
Hello all, I am looking for an editor for R which has got functions beyond the normal R editor that is included in the program. I had a look at VIM but I think it's difficult if you are just starting programming. Could anyone recommend an editor that is suitable for beginners? Thanks for your help. Marion [[alternative HTML version deleted]]
2011 Jun 01
4
subsetting with condition
Dear R Team, I am a new R user and I am currently trying to subset my data under a special condition. I have went through several pages of the subsetting section here on the forum, but I was not able to find an answer. My data is as follows: ID NAME MS Pol. Party 1 John x F 2 Mary s S
2011 Mar 31
1
Sequential multiple regression
Hello, In the past I have tended to reside more in the ANOVA camp but am trying to become more familiar with regression techniques in R. I would like to get the F change from a model as I take away factors: SO... mod1<-lm(y~x1+x2+x3).......mod2<-lm(y~x1,x2).......mod3<-lm(y~x1) I can do this by hand by running several models in R and taking the MSr1/MSe1, MSr2/MSe2... This is
2011 Aug 30
3
Simulating distribution of max of two die
Hallo I am teaching a very elementary intro course about R, and want to show the students how to find the distribution of the maximum of rolling two balanced die. Is there perhaps a more elegant way to do this, other than the way I am using below? (I would like to show them two ways - the one shown here, and perhaps and improved/elegant approach (showing off the "beauty" of R.
2011 Sep 16
2
"rounding" to a number that is LOWER than my number
Hello! What function would allow me to "round" down, rather than up? For example, x<-1.98 I'd like to get 1.9 - rather than 2.0. Reason - I am creating a minimum for an axis for a plot, and I need it to be lower than x (which, in turn, is the lowest number already). Thank you! -- Dimitri Liakhovitski marketfusionanalytics.com
2011 Jul 17
4
special question on regression
Hello R-people! I have a general statistical question about regressions. I just want to describe my case: I have got a dataset of around 150 observations and 1 dependent and 2 independent variables. The dependent variable is of metric nature (in my case meters in a range from around 0.5-10000 m). The first independent is also metric (in mm ranging from 50-700 mm) and it is assumed to be
2011 Apr 03
6
[Bug 713] New: CPPFLAGS are mishandled which breaks non-shared targets
http://bugzilla.netfilter.org/show_bug.cgi?id=713 Summary: CPPFLAGS are mishandled which breaks non-shared targets Product: iptables Version: unspecified Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P5 Component: unknown AssignedTo: netfilter-buglog at
2011 Jul 29
2
[Bug 732] New: Iptables 1.4.11 or 1.4.12 does not compile on CentOS 5.6
http://bugzilla.netfilter.org/show_bug.cgi?id=732 Summary: Iptables 1.4.11 or 1.4.12 does not compile on CentOS 5.6 Product: netfilter/iptables Version: linux-2.6.x Platform: x86_64 OS/Version: RedHat Linux Status: NEW Severity: critical Priority: P1 Component: ip_tables (kernel) AssignedTo:
2011 Oct 09
2
help with statistics in R - how to measure the effect of users in groups
Hi, I'm a newbie to R. My knowledge of statistics is mostly self-taught. My problem is how to measure the effect of users in groups. I can calculate a particular attribute for a user in a group. But my hypothesis is that the user's attribute is not independent of each other and that the user's attribute depends on the group ie that user's behaviour change based on the group. Let
2011 Jun 07
4
[Bug 720] New: iptables no longer compiles for Linux 2.4 because it uses linux/magic.h
http://bugzilla.netfilter.org/show_bug.cgi?id=720 Summary: iptables no longer compiles for Linux 2.4 because it uses linux/magic.h Product: iptables Version: unspecified Platform: All OS/Version: All Status: NEW Severity: major Priority: P3 Component: iptables AssignedTo:
2011 Jul 02
4
[Bug 727] New: Open your firewall by a simple typo
http://bugzilla.netfilter.org/show_bug.cgi?id=727 Summary: Open your firewall by a simple typo Product: iptables Version: unspecified Platform: All OS/Version: All Status: NEW Severity: major Priority: P2 Component: iptables AssignedTo: netfilter-buglog at lists.netfilter.org ReportedBy:
2007 Feb 28
4
Help Needed: Can't make "local" calls on a brand new PRI
Hello, I just installed a PRI and when I make a local (seven digit) call, I get Code 28 back from the telco, (I believe code 28 means "Invalid Number") and I hear a fast busy on the phone. Here is the output: -- Executing Dial("SIP/marke-17b1", "ZAP/G1/4967171") in new stack -- Requested transfer capability: 0x00 - SPEECH -- Called G1/4967171
2011 Jul 13
4
[Bug 728] New: ip_tables: limit match: invalid size 40!=48
http://bugzilla.netfilter.org/show_bug.cgi?id=728 Summary: ip_tables: limit match: invalid size 40!=48 Product: netfilter/iptables Version: linux-2.6.x Platform: mips64 OS/Version: Debian GNU/Linux Status: NEW Severity: critical Priority: P2 Component: ip_tables (kernel) AssignedTo:
2011 Mar 07
3
[Bug 707] New: Trivial SNAT manpage error
http://bugzilla.netfilter.org/show_bug.cgi?id=707 Summary: Trivial SNAT manpage error Product: iptables Version: unspecified Platform: All OS/Version: All Status: NEW Severity: trivial Priority: P5 Component: iptables AssignedTo: netfilter-buglog at lists.netfilter.org ReportedBy: