similar to: data frame manipulation with conditions

Displaying 20 results from an estimated 10000 matches similar to: "data frame manipulation with conditions"

2012 Feb 24
2
data frame manipulation with condition
Dear list, n00b question, but still can't find any easy answer. Here is a df: > df<-data.frame(cbind(x=c("AA","BB","CC","AA"),y=1:4)) > df x y 1 AA 1 2 BB 2 3 CC 3 4 AA 4 I want to modify this df this way : if df$x=="AA" then df$y=df$y*10 if df$x=="BB" then df$y=df$y*25 and so on with other conditions. TY for any
2012 Feb 07
1
replace elements of a data frame
Hello, I am getting mad at finding a simple way to replace elements of a df. Here is a short df : > names<-c("BO","C","CL") > price<-c("10","25","20") > df<-data.frame(names,price) I want to replace "BO" by "BOB", "C" by "CR", "CL" by "CLO", and the list is
2012 Feb 09
2
ifelse
Hello, I need to print a screen message after a test. >list<-c("10","1","100","10") >ifelse(all(list %in% c(1,10,100)==TRUE),cat("YES\n"),cat("NO\n")) YES Error in ifelse(all(l %in% c(1, 10, 100) == TRUE), cat("YES\n"), cat("NO\n")) : replacement has length zero I have the correct answer, YES, but with
2012 Feb 27
1
compare two data frames with same columns names but of different dimensions
Dear List, I want to compare and return the rows which are NOT in the two data frames. Classic methods don't work as the df have NOT the same dimensions. Here are one example of my df: reported <- structure(list(Product = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 3L, 4L, 5L, 5L), .Label = c("Cocoa", "Coffee C", "GC", "Sugar No 11", "ZS"),
2012 Feb 27
2
compare two data frames of different dimensions and only keep unique rows
Dear list, I am still struggling with something that should be easy: I compare two data frames with a lot of common rows and want to keep only rows that are NOT in both data frames, unique. Here are an example of these data frame. reported <- structure(list(Product = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 3L, 4L, 5L, 5L), .Label = c("Cocoa", "Coffee C", "GC",
2008 Jun 18
4
help with manipulating data frames (survey analysis)
Dear all, Can anyone recommend a good book or an online tutorial for using data frames in R? I want to do statistical analysis on some survey data and I can specify what I would like to do very easily in algorithmic terms. However, being a n00b to R I am struggling with getting R to execute what I want. I think all I need is some source that directs me in the right direction by walking me
2006 Mar 22
2
n00b question
Total Ruby N00b here with a question about the Hibbs OnLamp tutorial. I''m trying to hook up to my cookbook database and I''m getting: ActiveRecord::StatementInvalid in Recipe#index Mysql::Error: #42S02Table ''cookbook.recipes'' doesn''t exist: SELECT COUNT(*) FROM recipes RAILS_ROOT: ./script/../config/.. My thoughts: I think I''m not actually
2006 May 15
3
Page hit counter?
Hello all, Yet another "don''t reinvent the wheel" n00b question: Is there an ''official'' page hit counter plugin/code snippet/whatever? I would need something like this: - It is possibility to set a constant timespan (say 5 hours). - On every page hit, save away @request.remote_ip and Time.new - The counter gets incremented only if the same IP was here
2004 Aug 06
2
Problem with livice
Trying to get livice to work on my FreeBSD system..major 'n00b' so bear with me :D <p>When I run ./livice I get the following ------------------------------------------------------------- /local/liveice/temp.playlist ...... done setup_pipes()... Initialising pipes for stream 0 Successfuly set up fifo .liveice_temp_files/raw.pipe0 Successfuly set up fifo
2006 Jan 18
3
Partial Problems
Hey guys, I''m having a little trouble working out partials. I have successfully made a partial work in my list.rhtml, but as I see it on the 15min introductry video. They guy uses one partial on multipul pages. At the moment I am trying this in my show.rhtml, I write <%= render :partial => "journal" %> and I get this. NoMethodError in Write#show > > Showing
2009 Feb 12
4
Easy RoR <-> Javascript syntax question
Hi there, a simple n00b question: I have that Javascript snippet on my page (see below; taken from jquery, actually). I want to pass it the "@cities" array from the controller. But what''s the correct syntax, here? See the 3rd line: ======================================== <script> $(document).ready(function(){ var data = @cities; <---- that''s
2005 Aug 09
2
Upgrading Drive, Best Practice?
Hi, This might sound like a n00b question, but I've honestly never done this with a Linux machine... (it is running Centos3) We have a 1U mail server with two 36GB SCSI drives in a hardware mirror config. There's no more room for any other drives in the case. It's filling up, so we now have two 74GB drives ready to take their place. Possible solutions that I've come up
2006 Jul 12
5
start_form_tag n00b question
Hi, I''m wondering if there is any way to specify the id of a form tag with the start_form_tag helper. I''ve tried playing around with ", id=>"marginForm" " and also inclosing both the action variable and id variable in curley brackets. The Rails API doesn''t off much help for a n00b like me. It''s probably really easy but any help you guys
2010 Nov 17
5
n00b, how to uninstall wine completely and reinstall, Ubuntu.
I installed wine on my desktop running ubuntu 10.04. All was working fine until I installed battlefield 1942. I had an issue so decided to uninstall wine and try again. When I reinstalled wine, I get no Programs item in the menu. I can browse to the folder when browsing the c drive. I started to uninstall BF1942 to try again and had a power cut during the process. Is there any way to completely
2009 Dec 28
4
Megatec driver floods logs #2 & mail notifications
Hi there! I'm a n00b NUT user trying to get it running on RHEL5 and actually do something useful for me. Few questions: 1) I want it to notify me by email on power loss and power back events. I can't find any sample scripts for this purpose... Where shall I look for them? 2) So far, I've backported the package from Fedora and got my Ablerex running (previously used with Upsilon /
2015 Mar 25
2
Networking issues in host
I've been having intermittent network issues on my Host - they go away when I stop and disable libvirtd and then reboot. They do not go away if I just stop libvirtd and don't reboot. I'm at a loss as to where to start with my troubleshooting, and being a relative n00b to libvirt, I'd love any pointers. Regards, Richard
2017 Aug 31
3
Natural vs National in R signon banner?
The R signon banner includes this statement: Natural language support but running in an English locale Should that not say 'National' instead of 'Natural'? Meaning that LOCALE support is enabled, not that the interface understands human language? Please ignore this and forgive me if this is an inappropriate post. I am a N00B in R. [[alternative HTML version deleted]]
2017 Jun 09
4
Proposed new documentation "Configuration Examples"
Most of the questions asked in the nut-user mailing list seem to me to be either erudite technical discussion of new and exotic UPS units, or n00b questions of the style "I have this old UPS so I installed NUT but it didn't work". NUT is thoroughly documented with man pages and User Manual, but from my own experience it is not easy for Joe N00b to know what a working setup
2005 Jan 31
1
Problem with tcng
Hi folks, first of all, sorry for my bad English ^^ and for the fact that I am a Linux N00b. I have a little Problem installing TCng on my Debian System. At the make install command the following error occured: tar: lib/tcng/include/klib/kernel/include: Cannot stat: no such file or directory tar: Error exit delayed from previous errors Can somebody help me ? greets Marcus -- GMX im TV
2006 Feb 24
1
Form within table?
Ok, I figured out my problem (kind of) from "Help a n00b?" The problem was that (at least in Firefox) you can''t have a form within a table, it has to be the other way around. Once I put the form on the outside everything started to work. w00t! -- David Olbersen dave@toasterwaffles.com