I am using the following code to extract raster values over a SpatialPolygonDataFrame.  result&lt;-extract(Stack, polygons)  &gt;Stack class       : RasterStack  dimensions  : 634, 862, 546508, 13  (nrow, ncol, ncell, nlayers) resolution  : 10, 10  (x, y) extent      : 492660, 501280, 4378960, 4385300  (xmin, xmax, ymin, ymax) coord. ref. : +proj=utm +zone=29 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0  names       : L2A_T29SM//21_B02_10m//etc.  min values  :             1.0000000,             1.0000000,             1.0000000,             1.0000000,             1.0000000,             1.0000000,             1.0000000,           119.0000000,            88.0000000,             1.0000000,   -0.9932203,   -0.9959184,    1.0000000  max values  :          1.460000e+04,          1.547100e+04,          1.485900e+04,          1.547600e+04,          1.168700e+04,          1.131400e+04,          1.109100e+04,          1.084500e+04,          1.451000e+04,          1.105000e+04, 9.996238e-01, 9.992918e-01, 4.000000e+00     &gt; polygons class       : SpatialPolygonsDataFrame  features    : 13  extent      : 493428.6, 499603.9, 4379481, 4383781  (xmin, xmax, ymin, ymax) coord. ref. : +proj=utm +zone=29 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0  variables   : 3 names       : id, ID_1,    LC  min values  :  1,    1,  Agri  max values  :  9,    4, Water    Then I want to create a dataframe out of it but I received the following error:  resultdf&lt;-as.data.frame(result) Error: arguments imply differing number of rows: 225, 320, 286, 351, 68, 79, 41, 63, 70, 171, 72, 158, 497.    From what I check in the forum it is a problem with the data structure since the dataframe would not have the same length; how can I solve it?
I have a raster image (Sentinel-2 band 4) and a shapefile covering the same area than the image (same projection and extension). The shapefile has different polygons which are agricultural fields.   I want to create a new file where, for each polygon, the mean value of the pixels that are inside it is calculated.  Could you please help me to find an appropriate R code for that?
How to append to a file with fstream fstream::app flag seems not to work SF Short Story about resetting the world every day Trying to identify a short story. I recall it was quite short, shorter than a novella. I read it within the last few years, but my impression is that it's from the second half of the twentieth century, maybe the sixties. I can't recall if I read it online, in an anthology, or collection. Set in America, a middle-aged man stumbles on a team (maybe like dwarves or gnomes) whose job it is to set up the world for the next day by removing all the previous day's &quot;stuff&quot;, like street furniture? (I know that makes no sense). He disrupts this process and somehow prevents progressing to the next day. I also remember the story was quite lighthearted with the team behaving in a very grumpy way like interrupted workmen. I thought the title was something like &quot;What happened to Tuesday&quot; or similar. For some reason, I thought it was by Keith Laumer, but a search doesn't reveal anything. The trope was similar to &quot;The Tunnel Under the World&quot; by Pohl, and &quot;The Adjustment Team&quot; by Dick, in that reality was constantly changed and controlled by an organisation of some kind. Convert 12-hour date/time to 24-hour date/time I have a tab delimited file where each record has a timestamp field in 12-hour format:     mm/dd/yyyy hh:mm:ss [AM|PM].   I need to quickly convert these fields to 24-hour time:     mm/dd/yyyy HH:mm:ss.   What would be the best way to do this? I'm running on a Windows platform, but I have access to sed, awk, perl, python, and tcl in addition to the usual Windows tools. Will the below code cause memory leak in c++ class someclass {};  class base {     int a;     int *pint;     someclass objsomeclass;     someclass* psomeclass; public:     base()     {         objsomeclass = someclass();         psomeclass = new someclass();         pint = new int();          throw "constructor failed";         a = 43;     } }  int main() {     base temp(); }   In the above code, the constructor throws. Which objects will be leaked, and how can the memory leaks be avoided?  int main() {     base *temp = new base(); }   How about in the above code? How can the memory leaks be avoided after the constructor throws? How to use siunitx with non numerical values? Do I need to have antivirus software installed? I thought that there was no need to scan for viruses either in Ubuntu or any Linux distros until I found virus scanner packages clamtk and klamav in Ubuntu software center yesterday.  This leads to the following questions:   How do viruses differ between Linux and Windows? How do the strategies for protection differ between Linux and Windows? Should a virus scanner package be installed on my system? If so, which would be a better option? For me at least,  has answers that are not sorted by score:    Is this normal?  I've tried refreshing the page a few times, but the order doesn't change... How do I use formatting in comments? I see some people write comments that are for example - in italics.  I do not see any way of doing that while writing my comments. Why is it so? Manually change filetype icons in Windows 7 I'm trying to find the dialog tab in Windows 7 that allows a user to change the icon used for a particular file type.  In Windows XP it would be under the Folder Options properties dialog.    Where is it on Windows 7?  I only want to change the icon of a specific filetype, to anything I want but this tab is no longer present in Folder Options of Windows 7. The add comment link and comment box overlaps bounty box The following you could have seen in  (sorry, I've commented there, so you won't see it anymore) in Chrome 35.0.1916.153 m (current version). Notice how the add comment link overlaps the bounty box:    The same you can observe with a comment box on other sites, e.g. at this time in :    Could you shift it a bit down ?  It seems that it happens on more than just Stack Overflow (maybe all sites ?). xticks steps using Pgfplots / dateplot How to change launcher icon Is there a way to customize a Lucid Lynx Launcher icon for various programs? There does not seem to be a way to do this using Create Launcher or Launcher properties. The application is not actually "installed" on the PC, the executable has just been copied. All I've been able to do so far is to add the command /home/t32/bin/pc_linux/t32marm -c /home/t32/config_usb.t32 to a generic Launcher icon using Create Launcher. Xubuntu Dropbox icon fail Integral of $\frac{\sqrt{x^2+1}}{x}$ So I have to do the integration of $\frac{\sqrt{x^2+1}}{x}$. Give me a hint. What should I replace? Should I do it with integration by parts? I am having problems with the su command. I know my password and I am typing it correctly but su indicates authentication failure.  So I checked on the internet and then went into recovery mode and changed my username's password to what I was entering before.  Even now entering the same password on su gives me authentication failure.  Please suggest what am I doing wrong?? One-byte-off pointer still valid in C? Is it true that quantum mechanics technically allows anything to happen? Maybe this is a silly question (I think it is), but it's a question I'm arguing with some of my friends for a long time.  The ultimate question is: Is everything (in our Universe) possible ?  I've read some books (Penrose, Hawking, Greene, etc.) where it was clearly stated several times that quantum mechanics allows any situation to happen (e.g. everything is possible) - even with absurdly tiny probabilities?  Does this mean only physically possible - or "ultimate" possible ?  For example (I know this example seems really absurd, but I'm saying this so you get the idea) what my friends clame it is possible:   If I ask my friend(s): "Is it possible there is a Sun-sized star in my pocket right now?" They will respond: "Yes, there is very very tiny possibility this can be true!" Etc. Mean or sum of gradients for weight updates in SGD Proving $1^3+ 2^3 + \cdots + n^3 = \left(\frac{n(n+1)}{2}\right)^2$ using induction What is the difference between range and xrange functions in Python 2.X?